From: Vadim Zeitlin <vadim@wxwidgets.org> Date: Sun, 8 Sep 2002 23:12:19 +0000 (+0000) Subject: fixed bug in parsing formats in which fields don't have any non-numeric delimiters X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4147efe9ab3f1d7f299e8224e4ad9af2fc3c8ca4 fixed bug in parsing formats in which fields don't have any non-numeric delimiters git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@17090 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/datetime.cpp b/src/common/datetime.cpp index 11966062a4..1f3ba66047 100644 --- a/src/common/datetime.cpp +++ b/src/common/datetime.cpp @@ -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 ) {