]> git.saurik.com Git - wxWidgets.git/commitdiff
fixed bug in parsing formats in which fields don't have any non-numeric delimiters
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 8 Sep 2002 23:12:19 +0000 (23:12 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 8 Sep 2002 23:12:19 +0000 (23:12 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@17090 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/datetime.cpp

index 11966062a4f116374aec1d5b0a59f13efa72668a..1f3ba66047b6659ff8044cf8ed1ae2041c4f3393 100644 (file)
@@ -2548,6 +2548,30 @@ const wxChar *wxDateTime::ParseFormat(const wxChar *date,
             width += *fmt - _T('0');
         }
 
+        // the default widths for the various fields
+        if ( !width )
+        {
+            switch ( *fmt )
+            {
+                case _T('Y'):               // year has 4 digits
+                    width = 4;
+                    break;
+
+                case _T('j'):               // day of year has 3 digits
+                case _T('l'):               // milliseconds have 3 digits
+                    width = 3;
+                    break;
+
+                case _T('w'):               // week day as number has only one
+                    width = 1;
+                    break;
+
+                default:
+                    // default for all other fields
+                    width = 2;
+            }
+        }
+
         // then the format itself
         switch ( *fmt )
         {