summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2017-11-09 21:13:43 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2017-11-14 16:44:27 +0000
commit285596ee199ae1767fc48a0d0c2d12b178c0234d (patch)
tree4127767bffcdc8eefeb84ed07fc4b3f6595acd8b /tests
parent1456a7b78aad6ad3edf91dec7be76a7cb885cd24 (diff)
Special-case parsing of Zulu time-zone in date-times
When parsing a date-time's zone, a stray Z denotes UTC (a.k.a. Zulu time), despite not being a valid name for the zone. Clients parsing such date strings had to treat the Z as a literal, rather than a zone-ID, but then they got back a LocalTime instead of the UTC the string actually described. So teach QTimeZoneParser to handle this special case and adapt an existing test (that used a time ending in Z, but had to treat it as a local time) to check this works. [ChangeLog][QtCore][QDateTime] When parsing a time-zone, "Z" is now recognized as an alias for UTC. Change-Id: Ib6aa2d8ea2dc6b2da526b39aec74dbc007f90fd8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
index c0ed88e154..7a047c67de 100644
--- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
+++ b/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
@@ -2396,8 +2396,8 @@ void tst_QDateTime::fromStringStringFormat_data()
QTest::newRow("data14") << QString("32.01.2004") << QString("dd.MM.yyyy") << invalidDateTime();
QTest::newRow("data15") << QString("Thu January 2004") << QString("ddd MMMM yyyy") << QDateTime(QDate(2004, 1, 1), QTime());
QTest::newRow("data16") << QString("2005-06-28T07:57:30.001Z")
- << QString("yyyy-MM-ddThh:mm:ss.zZ")
- << QDateTime(QDate(2005, 06, 28), QTime(07, 57, 30, 1));
+ << QString("yyyy-MM-ddThh:mm:ss.zt")
+ << QDateTime(QDate(2005, 06, 28), QTime(07, 57, 30, 1), Qt::UTC);
}
void tst_QDateTime::fromStringStringFormat()