Extend limits of allowed time zone offsets

This commit is contained in:
Dimitri Schoolwerth
2017-06-21 01:30:37 +04:00
committed by Dimitri Schoolwerth
parent af309e6d96
commit 9b9f8ac468
2 changed files with 10 additions and 3 deletions

View File

@@ -1549,7 +1549,14 @@ wxDateTime::ParseFormat(const wxString& date,
}
}
if ( hours > 12 || minutes > 59 )
/*
Contemporary offset limits are -12:00 and +14:00.
However historically offsets of over +/- 15 hours
existed so be a bit more flexible. Info retrieved
from Time Zone Database at
https://www.iana.org/time-zones.
*/
if ( hours > 15 || minutes > 59 )
return false; // bad format
timeZone = 3600*hours + 60*minutes;

View File

@@ -925,8 +925,8 @@ void DateTimeTestCase::TestTimeZoneParse()
// Some invalid ones too.
{ "00:00-1300" }, // Offset out of range.
{ "00:00+1300" }, // Offset out of range.
{ "00:00-1600" }, // Offset out of range.
{ "00:00+1600" }, // Offset out of range.
{ "00:00+00:" }, // Minutes missing after colon separator.