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:
Vadim Zeitlin
2010-01-04 11:05:47 +00:00
parent 462f4f19b5
commit 8b7d411f14
2 changed files with 18 additions and 3 deletions

View File

@@ -1941,7 +1941,7 @@ wxDateTime::ParseTime(const wxString& time, wxString::const_iterator *end)
"%I:%M:%S %p", // 12hour with AM/PM
"%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
"%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
// completely different -- try it last

View File

@@ -1099,8 +1099,23 @@ void DateTimeTestCase::TestDateTimeParse()
bool good;
} 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