]> git.saurik.com Git - wxWidgets.git/commit
Correct wxDateTime::GetWeekOfMonth() for days in the beginning of January.
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 17 Dec 2009 17:51:12 +0000 (17:51 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 17 Dec 2009 17:51:12 +0000 (17:51 +0000)
commit404013f849619f420c671dab801e1aa4b2749836
treee832c39a5d63f9c885af0cf27701fc1f31fd9ac9
parenta30305f8b0413a7df8a49d669e64502cdd46a345
Correct wxDateTime::GetWeekOfMonth() for days in the beginning of January.

This function was implemented in terms of GetWeekOfYear() which made it tricky
to get it right as GetWeekOfYear() can, correctly, return week number for the
previous year for the first days of January (and also from the next one for
the last days of December).

Replace this implementation with a simple one directly counting the number of
weeks since the first of the month, this seems to be much simpler and does
pass the new unit test case which the old version failed.

Also make the unit test failures more informative by using
WX_ASSERT_EQUAL_MESSAGE() instead of CPPUNIT_ASSERT_EQUAL().

See #11561.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62916 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
src/common/datetime.cpp
tests/datetime/datetimetest.cpp