]> git.saurik.com Git - wxWidgets.git/commitdiff
Correctly parse times without seconds in wxDateTime::ParseTime().
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 4 Jan 2010 11:05:47 +0000 (11:05 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 4 Jan 2010 11:05:47 +0000 (11:05 +0000)
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

src/common/datetimefmt.cpp
tests/datetime/datetimetest.cpp

index cf02a55357e2b4955f8bcc881755fc8e973ce88c..f9404d864292692cc3fff9b1486545be18cfab5e 100644 (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
 
index 4731265645cd3e9169be1727a1f9ef8f2801897c..c5766444db59857d875a6a8549328e60c7be9b7f 100644 (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