Add time zone parsing support for only specifying HH

This commit is contained in:
Dimitri Schoolwerth
2017-06-20 18:41:39 +04:00
committed by Dimitri Schoolwerth
parent 101433190f
commit 1a5163a882
2 changed files with 17 additions and 3 deletions

View File

@@ -1521,18 +1521,25 @@ wxDateTime::ParseFormat(const wxString& date,
}
// Optionally followed by a colon separator.
bool mustHaveMinutes = false;
if ( input != end && *input == wxS(':') )
{
mustHaveMinutes = true;
++input;
}
// Followed by exactly 2 digits for minutes (MM).
unsigned long minutes;
// Optionally followed by exactly 2 digits for minutes (MM).
unsigned long minutes = 0;
if ( !GetNumericToken(numRequiredDigits, input, end,
&minutes, &numScannedDigits)
|| numScannedDigits != numRequiredDigits)
{
return false; // No match.
if (mustHaveMinutes || numScannedDigits)
{
// No match if we must have minutes, or digits
// for minutes were specified but not exactly 2.
return false;
}
}
if ( hours > 12 || minutes > 59 )