git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55900
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
Tm tm = tmDef;
// set the date
Tm tm = tmDef;
// set the date
+ if ( haveMon )
+ {
+ tm.mon = mon;
+ }
+
if ( haveYear )
{
tm.year = year;
if ( haveYear )
{
tm.year = year;
// TODO we don't check here that the values are consistent, if both year
// day and month/day were found, we just ignore the year day and we
// also always ignore the week day
// TODO we don't check here that the values are consistent, if both year
// day and month/day were found, we just ignore the year day and we
// also always ignore the week day
- if ( haveMon && haveDay )
- if ( mday > GetNumOfDaysInMonth(tm.year, mon) )
+ if ( mday > GetNumOfDaysInMonth(tm.year, tm.mon) )
{
wxLogDebug(_T("bad month day in wxDateTime::ParseFormat"));
return NULL;
}
{
wxLogDebug(_T("bad month day in wxDateTime::ParseFormat"));
return NULL;
}
tm.mday = mday;
}
else if ( haveYDay )
tm.mday = mday;
}
else if ( haveYDay )
const char *result = dt2.ParseFormat(s, fmt);
if ( !result )
{
const char *result = dt2.ParseFormat(s, fmt);
if ( !result )
{
- // converion failed - should it have?
+ // conversion failed - should it have?
CPPUNIT_ASSERT( kind == CompareNone );
}
else // conversion succeeded
CPPUNIT_ASSERT( kind == CompareNone );
}
else // conversion succeeded
+ wxDateTime dt;
+
+ // test partially specified dates too
+ wxDateTime dtDef(26, wxDateTime::Sep, 2008);
+ CPPUNIT_ASSERT( dt.ParseFormat("17", "%d") );
+ CPPUNIT_ASSERT_EQUAL( 17, dt.GetDay() );
+
// test compilation of some calls which should compile (and not result in
// ambiguity because of char*<->wxCStrData<->wxString conversions)
// test compilation of some calls which should compile (and not result in
// ambiguity because of char*<->wxCStrData<->wxString conversions)
wxString s("foo");
CPPUNIT_ASSERT( !dt.ParseFormat("foo") );
CPPUNIT_ASSERT( !dt.ParseFormat(wxT("foo")) );
wxString s("foo");
CPPUNIT_ASSERT( !dt.ParseFormat("foo") );
CPPUNIT_ASSERT( !dt.ParseFormat(wxT("foo")) );