From a3a4e7c638cdf6efec9b7fce635fd546b7bc580f Mon Sep 17 00:00:00 2001 From: Dimitri Schoolwerth Date: Tue, 20 Jun 2017 15:17:05 +0400 Subject: [PATCH] Add time zone parsing support for 'Z' (UTC indicator) --- src/common/datetimefmt.cpp | 8 ++++++++ tests/datetime/datetimetest.cpp | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/common/datetimefmt.cpp b/src/common/datetimefmt.cpp index 86aca9f32f..26ba97be77 100644 --- a/src/common/datetimefmt.cpp +++ b/src/common/datetimefmt.cpp @@ -1482,6 +1482,14 @@ wxDateTime::ParseFormat(const wxString& date, if ( input == end ) return false; + if ( *input == wxS('Z') ) + { + // Time is in UTC. + ++input; + haveTimeZone = true; + break; + } + // and then check that it's either plus or minus sign bool minusFound; if ( *input == wxT('-') ) diff --git a/tests/datetime/datetimetest.cpp b/tests/datetime/datetimetest.cpp index a9cd0c8ab7..b3a7cfe1f0 100644 --- a/tests/datetime/datetimetest.cpp +++ b/tests/datetime/datetimetest.cpp @@ -903,6 +903,9 @@ void DateTimeTestCase::TestTimeZoneParse() { "13:37+0000", true }, { "17:37+0400", true }, + // Z as UTC designator. + { "13:37Z", true }, + // Some invalid ones too. { "00:00-1300" }, // Offset out of range. { "00:00+1300" }, // Offset out of range.