]> git.saurik.com Git - wxWidgets.git/commitdiff
fix for better European date format parsing
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 8 Jan 2001 16:48:59 +0000 (16:48 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 8 Jan 2001 16:48:59 +0000 (16:48 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9067 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/datetime.cpp

index fa2ab9cabb27174a010d913c13f72b8cdaeef700..e259d1824b2a6673bba476afb7048b0cbb3cd67e 100644 (file)
@@ -3157,14 +3157,27 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date)
                 // it's a month
                 if ( haveMon )
                 {
                 // it's a month
                 if ( haveMon )
                 {
-                    break;
+                    // but we already have a month - maybe we guessed wrong?
+                    if ( !haveDay )
+                    {
+                       // no need to check in month range as always < 12, but
+                        // the days are counted from 1 unlike the months
+                        day = (wxDateTime_t)mon + 1;
+                        haveDay = TRUE;
+                    }
+                    else
+                    {
+                        // could possible be the year (doesn't the year come
+                        // before the month in the japanese format?) (FIXME)
+                        break;
+                       }
                 }
 
                 mon = mon2;
 
                 haveMon = TRUE;
             }
                 }
 
                 mon = mon2;
 
                 haveMon = TRUE;
             }
-            else
+            else // not a valid month name
             {
                 wday = GetWeekDayFromName(token, Name_Full | Name_Abbr);
                 if ( wday != Inv_WeekDay )
             {
                 wday = GetWeekDayFromName(token, Name_Full | Name_Abbr);
                 if ( wday != Inv_WeekDay )
@@ -3177,7 +3190,7 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date)
 
                     haveWDay = TRUE;
                 }
 
                     haveWDay = TRUE;
                 }
-                else
+                else // not a valid weekday name
                 {
                     // try the ordinals
                     static const wxChar *ordinals[] =
                 {
                     // try the ordinals
                     static const wxChar *ordinals[] =
@@ -3203,7 +3216,7 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date)
                         wxTRANSLATE("nineteenth"),
                         wxTRANSLATE("twentieth"),
                         // that's enough - otherwise we'd have problems with
                         wxTRANSLATE("nineteenth"),
                         wxTRANSLATE("twentieth"),
                         // that's enough - otherwise we'd have problems with
-                        // composite (or not) ordinals otherwise
+                        // composite (or not) ordinals
                     };
 
                     size_t n;
                     };
 
                     size_t n;