From: Vadim Zeitlin Date: Thu, 4 Oct 2012 22:48:07 +0000 (+0000) Subject: Add wxDateSpan::GetTotalMonths() method. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/16630eb7e3ef05fa487b67188df12d10e66a5beb Add wxDateSpan::GetTotalMonths() method. This is similar to the existing GetTotalDays() and counts both months and years. See #14704. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72615 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/changes.txt b/docs/changes.txt index 8bcc67f1e9..c2240e528d 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -535,7 +535,7 @@ All: - Fix compilation of wxHash{Map,Set} with g++ 4.7 (Nathan Ridge). - Fix posting large amounts of data in wxHTTP (Platonides). - Add wxFile::ReadAll() for consistency with wxFFile. -- Add wxDateTime::DiffAsDateSpan() (jonasr). +- Add wxDateTime::DiffAsDateSpan() and wxDateSpan::GetTotalMonths() (jonasr). - Added Nepali translation (Him Prasad Gautam). All (GUI): diff --git a/include/wx/datetime.h b/include/wx/datetime.h index caeae26bda..f6bb9cdc29 100644 --- a/include/wx/datetime.h +++ b/include/wx/datetime.h @@ -1579,6 +1579,8 @@ public: int GetYears() const { return m_years; } // get number of months int GetMonths() const { return m_months; } + // returns 12*GetYears() + GetMonths() + int GetTotalMonths() const { return 12*m_years + m_months; } // get number of weeks int GetWeeks() const { return m_weeks; } // get number of days diff --git a/interface/wx/datetime.h b/interface/wx/datetime.h index 1785f392cc..01ef279dcf 100644 --- a/interface/wx/datetime.h +++ b/interface/wx/datetime.h @@ -1703,6 +1703,16 @@ public: */ int GetMonths() const; + /** + Returns the combined number of months in this date span, counting both + years and months. + + @see GetYears(), GetMonths() + + @since 2.9.5 + */ + int GetTotalMonths() const; + /** Returns the combined number of days in this date span, counting both weeks and days. This doesn't take months or years into account.