Skip to content

Commit

Permalink
Extend limits of allowed time zone offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
discnl committed Jun 22, 2017
1 parent af309e6 commit 9b9f8ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/common/datetimefmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions tests/datetime/datetimetest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 9b9f8ac

Please sign in to comment.