X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cf9f6737895ace461dcc8ce55ba56bebb97c6a4b..107b52ed174279e09b0bb79fe474ae90dcfdb206:/src/common/datetime.cpp diff --git a/src/common/datetime.cpp b/src/common/datetime.cpp index f6ad3f6259..0a58ed3f86 100644 --- a/src/common/datetime.cpp +++ b/src/common/datetime.cpp @@ -487,8 +487,10 @@ static wxString CallStrftime(const wxString& format, const tm* tm) if ( !wxStrftime(buf, WXSIZEOF(buf), format, tm) ) { - // buffer is too small? + // if the format is valid, buffer must be too small? wxFAIL_MSG(_T("strftime() failed")); + + buf[0] = '\0'; } s = buf; @@ -3665,6 +3667,11 @@ wxDateTime::ParseFormat(const wxString& date, Tm tm = tmDef; // set the date + if ( haveMon ) + { + tm.mon = mon; + } + if ( haveYear ) { tm.year = year; @@ -3673,16 +3680,15 @@ wxDateTime::ParseFormat(const wxString& date, // TODO we don't check here that the values are consistent, if both year // day and month/day were found, we just ignore the year day and we // also always ignore the week day - if ( haveMon && haveDay ) + if ( haveDay ) { - if ( mday > GetNumOfDaysInMonth(tm.year, mon) ) + if ( mday > GetNumOfDaysInMonth(tm.year, tm.mon) ) { wxLogDebug(_T("bad month day in wxDateTime::ParseFormat")); return NULL; } - tm.mon = mon; tm.mday = mday; } else if ( haveYDay )