]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/datetimefmt.cpp
correction to last commit: Korean and Romanian translations will only be in 2.9.1...
[wxWidgets.git] / src / common / datetimefmt.cpp
index 72ed15dd826b03f75c4599e215119ed3f2c42605..b6a2fa3b35e33174e5bafa71398f8f6e2c40861c 100644 (file)
@@ -1168,25 +1168,25 @@ wxDateTime::ParseFormat(const wxString& date,
 
             case _T('p'):       // AM or PM string
                 {
-                    wxString am, pm, token = GetAlphaToken(input, end);
+                    wxString am, pm;
+                    GetAmPmStrings(&am, &pm);
 
-                    // some locales have empty AM/PM tokens and thus when formatting
-                    // dates with the %p specifier nothing is generated; when trying to
-                    // parse them back, we get an empty token here... but that's not
-                    // an error.
-                    if (token.empty())
-                        break;
+                    // we can never match %p in locales which don't use AM/PM
+                    if ( am.empty() || pm.empty() )
+                        return false;
 
-                    GetAmPmStrings(&am, &pm);
-                    if (am.empty() && pm.empty())
-                        return false;  // no am/pm strings defined
-                    if ( token.CmpNoCase(pm) == 0 )
+                    const size_t pos = input - date.begin();
+                    if ( date.compare(pos, pm.length(), pm) == 0 )
                     {
                         isPM = true;
+                        input += pm.length();
                     }
-                    else if ( token.CmpNoCase(am) != 0 )
+                    else if ( date.compare(pos, am.length(), am) == 0 )
+                    {
+                        input += am.length();
+                    }
+                    else // no match
                     {
-                        // no match
                         return false;
                     }
                 }
@@ -1615,7 +1615,6 @@ wxDateTime::ParseDate(const wxString& date, wxString::const_iterator *end)
     int year = 0;
 
     // tokenize the string
-    static const wxStringCharType *dateDelimiters = wxS(".,/-\t\r\n ");
     while ( p != pEnd )
     {
         // skip white space and date delimiters