Correctly parse times without seconds in wxDateTime::ParseTime().
This was always supposed to work but never did because of a typo in the "24 hour format without seconds" format specification. Fix this by removing the extra "%S" from it and add a test for this case. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63061 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1941,7 +1941,7 @@ wxDateTime::ParseTime(const wxString& time, wxString::const_iterator *end)
|
|||||||
"%I:%M:%S %p", // 12hour with AM/PM
|
"%I:%M:%S %p", // 12hour with AM/PM
|
||||||
"%H:%M:%S", // could be the same or 24 hour one so try it too
|
"%H:%M:%S", // could be the same or 24 hour one so try it too
|
||||||
"%I:%M %p", // 12hour with AM/PM but without seconds
|
"%I:%M %p", // 12hour with AM/PM but without seconds
|
||||||
"%H:%M:%S", // and a possibly 24 hour version without seconds
|
"%H:%M", // and a possibly 24 hour version without seconds
|
||||||
"%X", // possibly something from above or maybe something
|
"%X", // possibly something from above or maybe something
|
||||||
// completely different -- try it last
|
// completely different -- try it last
|
||||||
|
|
||||||
|
@@ -1099,8 +1099,23 @@ void DateTimeTestCase::TestDateTimeParse()
|
|||||||
bool good;
|
bool good;
|
||||||
} parseTestDates[] =
|
} parseTestDates[] =
|
||||||
{
|
{
|
||||||
{ "Thu 22 Nov 2007 07:40:00 PM",
|
{
|
||||||
{ 22, wxDateTime::Nov, 2007, 19, 40, 0}, true },
|
"Thu 22 Nov 2007 07:40:00 PM",
|
||||||
|
{ 22, wxDateTime::Nov, 2007, 19, 40, 0 },
|
||||||
|
true
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"2010-01-04 14:30",
|
||||||
|
{ 4, wxDateTime::Jan, 2010, 14, 30, 0 },
|
||||||
|
true
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"bloordyblop",
|
||||||
|
{ },
|
||||||
|
false
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
// the test strings here use "PM" which is not available in all locales so
|
// the test strings here use "PM" which is not available in all locales so
|
||||||
|
Reference in New Issue
Block a user