corrected parsing of dates like 01.02.03 (where year can be confused with the day) in ParseDate()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23695 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -3348,21 +3348,30 @@ const wxChar *wxDateTime::ParseDate(const wxChar *date)
|
|||||||
isMonth = TRUE;
|
isMonth = TRUE;
|
||||||
}
|
}
|
||||||
else // not the month
|
else // not the month
|
||||||
|
{
|
||||||
|
if ( haveDay )
|
||||||
|
{
|
||||||
|
// this can only be the year
|
||||||
|
isYear = TRUE;
|
||||||
|
}
|
||||||
|
else // may be either day or year
|
||||||
{
|
{
|
||||||
wxDateTime_t maxDays = haveMon
|
wxDateTime_t maxDays = haveMon
|
||||||
? GetNumOfDaysInMonth(haveYear ? year : Inv_Year, mon)
|
? GetNumOfDaysInMonth(haveYear ? year : Inv_Year, mon)
|
||||||
: 31;
|
: 31;
|
||||||
|
|
||||||
// can it be day?
|
// can it be day?
|
||||||
if ( (val == 0) || (val > (unsigned long)maxDays) ) // cast to shut up compiler warning in BCC
|
if ( (val == 0) || (val > (unsigned long)maxDays) )
|
||||||
{
|
{
|
||||||
|
// no
|
||||||
isYear = TRUE;
|
isYear = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else // yes, suppose it's the day
|
||||||
{
|
{
|
||||||
isDay = TRUE;
|
isDay = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( isYear )
|
if ( isYear )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user