From: Vadim Zeitlin Date: Fri, 3 Apr 2009 15:42:06 +0000 (+0000) Subject: allow for trailing periods in week day/month names (as used in e.g. French locale) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/6b26ab96f78694a28b604a9bcd3b269188929eaf allow for trailing periods in week day/month names (as used in e.g. French locale) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59998 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/datetimefmt.cpp b/src/common/datetimefmt.cpp index 9f81e2d83c..a6e9c59d4e 100644 --- a/src/common/datetimefmt.cpp +++ b/src/common/datetimefmt.cpp @@ -231,6 +231,21 @@ GetAlphaToken(wxString::const_iterator& p, return s; } +// scans all characters which can appear in a week day/month name +// +// this is different from GetAlphaToken() as some locales (e.g. fr_FR) use +// trailing periods after the abbreviated week day/month names +wxString +GetNameToken(wxString::const_iterator& p, + const wxString::const_iterator& end) +{ + wxString token = GetAlphaToken(p, end); + if ( p != end && *p == '.' ) + token += *p++; + + return token; +} + // parses string starting at given iterator using the specified format and, // optionally, a fall back format (and optionally another one... but it stops // there, really) @@ -978,7 +993,7 @@ wxDateTime::ParseFormat(const wxString& date, { wday = GetWeekDayFromName ( - GetAlphaToken(input, end), + GetNameToken(input, end), *fmt == 'a' ? Name_Abbr : Name_Full, DateLang_Local ); @@ -996,7 +1011,7 @@ wxDateTime::ParseFormat(const wxString& date, { mon = GetMonthFromName ( - GetAlphaToken(input, end), + GetNameToken(input, end), *fmt == 'b' ? Name_Abbr : Name_Full, DateLang_Local );