Fix ParseDate() for dates having day expressed as an ordinal
Previously the year was left unparsed, and the current year was incorrectly used even when the input provided a year.
This commit is contained in:
parent
700d763ebc
commit
945738042d
2 changed files with 3 additions and 2 deletions
|
|
@ -2033,9 +2033,9 @@ wxDateTime::ParseDate(const wxString& date, wxString::const_iterator *end)
|
|||
{
|
||||
const wxString ord = wxGetTranslation(ordinals[n]);
|
||||
const size_t len = ord.length();
|
||||
if ( date.compare(p - pBegin, len, ord) == 0 )
|
||||
if ( date.compare(pCopy - pBegin, len, ord) == 0 )
|
||||
{
|
||||
p += len;
|
||||
pCopy += len;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1249,6 +1249,7 @@ void DateTimeTestCase::TestDateParse()
|
|||
{ "31/03/2006", { 31, wxDateTime::Mar, 2006 }, true, "" },
|
||||
{ "Thu 20 Jun 2019", { 20, wxDateTime::Jun, 2019 }, true, "" },
|
||||
{ "20 Jun 2019 Thu", { 20, wxDateTime::Jun, 2019 }, true, "" },
|
||||
{ "Dec sixth 2017", { 6, wxDateTime::Dec, 2017 }, true, "" },
|
||||
|
||||
// valid, but followed by something
|
||||
{ "Dec 31 1979 was the end of 70s",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue