don't misinterpret the time after the date as a weekday (patch 1836708)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50732 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
3f0640b0a8
commit
804eeca5d5
@ -291,6 +291,10 @@ wxX11:
|
||||
2.8.8
|
||||
-----
|
||||
|
||||
All:
|
||||
|
||||
- Fixed bug with parsing some dates in wxDateTime (Bob Pesner)
|
||||
|
||||
All (GUI):
|
||||
|
||||
- Added wxWindow::GetNextSibling() and GetPrevSibling()
|
||||
|
@ -3963,8 +3963,8 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date)
|
||||
}
|
||||
else // not a valid month name
|
||||
{
|
||||
wday = GetWeekDayFromName(token, Name_Full | Name_Abbr);
|
||||
if ( wday != Inv_WeekDay )
|
||||
WeekDay wday2 = GetWeekDayFromName(token, Name_Full | Name_Abbr);
|
||||
if ( wday2 != Inv_WeekDay )
|
||||
{
|
||||
// a week day
|
||||
if ( haveWDay )
|
||||
@ -3972,6 +3972,8 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date)
|
||||
break;
|
||||
}
|
||||
|
||||
wday = wday2;
|
||||
|
||||
haveWDay = true;
|
||||
}
|
||||
else // not a valid weekday name
|
||||
|
@ -189,6 +189,7 @@ private:
|
||||
CPPUNIT_TEST( TestTimeTicks );
|
||||
CPPUNIT_TEST( TestParceRFC822 );
|
||||
CPPUNIT_TEST( TestDateParse );
|
||||
CPPUNIT_TEST( TestDateTimeParse );
|
||||
CPPUNIT_TEST( TestTimeArithmetics );
|
||||
CPPUNIT_TEST( TestDSTBug );
|
||||
CPPUNIT_TEST( TestDateOnly );
|
||||
@ -205,6 +206,7 @@ private:
|
||||
void TestTimeTicks();
|
||||
void TestParceRFC822();
|
||||
void TestDateParse();
|
||||
void TestDateTimeParse();
|
||||
void TestTimeArithmetics();
|
||||
void TestDSTBug();
|
||||
void TestDateOnly();
|
||||
@ -799,7 +801,7 @@ void DateTimeTestCase::TestDateParse()
|
||||
// some invalid ones too
|
||||
{ _T("29 Feb 2006") },
|
||||
{ _T("31/04/06") },
|
||||
{ _T("bloordyblop") }
|
||||
{ _T("bloordyblop") },
|
||||
};
|
||||
|
||||
// special cases
|
||||
@ -823,6 +825,37 @@ void DateTimeTestCase::TestDateParse()
|
||||
}
|
||||
}
|
||||
|
||||
void DateTimeTestCase::TestDateTimeParse()
|
||||
{
|
||||
static const struct ParseTestData
|
||||
{
|
||||
const wxChar *str;
|
||||
Date date; // NB: this should be in UTC
|
||||
bool good;
|
||||
} parseTestDates[] =
|
||||
{
|
||||
{ _T("Thu 22 Nov 2007 07:40:00 PM"),
|
||||
{ 22, wxDateTime::Nov, 2007, 19, 40, 0}, true },
|
||||
};
|
||||
|
||||
// special cases
|
||||
wxDateTime dt;
|
||||
for ( size_t n = 0; n < WXSIZEOF(parseTestDates); n++ )
|
||||
{
|
||||
wxDateTime dt;
|
||||
if ( dt.ParseDateTime(parseTestDates[n].str) )
|
||||
{
|
||||
CPPUNIT_ASSERT( parseTestDates[n].good );
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL( parseTestDates[n].date.DT(), dt );
|
||||
}
|
||||
else // failed to parse
|
||||
{
|
||||
CPPUNIT_ASSERT( !parseTestDates[n].good );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DateTimeTestCase::TestTimeArithmetics()
|
||||
{
|
||||
static const wxDateSpan testArithmData[] =
|
||||
|
Loading…
Reference in New Issue
Block a user