diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2016-11-03 19:00:24 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2017-11-14 17:18:21 +0000 |
commit | 948e24cb6deeaf0e55794032b90fdf20b7ef12c1 (patch) | |
tree | c611584badb1007adfa7b7dddb79264dab2cad8c /tests/auto/qml/qqmlecmascript/data/assignDate.qml | |
parent | 2b8b7a162be52f8cd6c2bc39f498a1ddfb59dd68 (diff) |
V4 Date.ParseString(): fix UTC-ness of date-only formats
ECMA-262 stipulates that date-only formats should be treated as UTC,
while date-times are handled as standard time, if no time zone is
explicitly given. Tidied up the parser a bit in the process and
documented what the spec says. Fixed some broken test-cases.
Handling of date-times without zone as local time is a correction
since edition 5.1 of ECMA-262 (which said to handle it as UTC):
http://www.ecma-international.org/ecma-262/7.0/index.html#sec-corrections-and-clarifications-in-ecmascript-2015-with-possible-compatibility-impact
We were previously handling both dates and date-times as local time,
violating the old spec for both and the revised spec for dates.
Task-number: QTBUG-56787
Change-Id: I557789d855b910ca6a859fca396af1a0205c9417
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/data/assignDate.qml')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/data/assignDate.qml | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/assignDate.qml b/tests/auto/qml/qqmlecmascript/data/assignDate.qml index 14fe20787b..73677e99f1 100644 --- a/tests/auto/qml/qqmlecmascript/data/assignDate.qml +++ b/tests/auto/qml/qqmlecmascript/data/assignDate.qml @@ -7,28 +7,31 @@ MyTypeObject { var dateTimeVar = new Date("2009-05-12T00:00:01") var dateTimeVar2 = new Date("2009-05-12T23:59:59") + // Date, with no zone specified, is implicitly UTC dateProperty = dateVar + // Date-time, with no zone, is implicitly local-time dateTimeProperty = dateTimeVar dateTimeProperty2 = dateTimeVar2 - // Commented properties do not currently test true: - boolProperty = //(dateProperty.getTime() == dateVar.getTime()) && + boolProperty = (dateProperty.getTime() == dateVar.getTime()) && (dateProperty.getFullYear() == 2009) && (dateProperty.getMonth() == 5-1) && - //(dateProperty.getDate() == 12) && - (dateProperty.getHours() == 0) && + (dateProperty.getDate() == 12) && + (dateProperty.getUTCHours() == 0) && + (dateProperty.getUTCMinutes() == 0) && + (dateProperty.getUTCSeconds() == 0) && (dateTimeProperty.getTime() == dateTimeVar.getTime()) && (dateTimeProperty.getFullYear() == 2009) && (dateTimeProperty.getMonth() == 5-1) && - //(dateTimeProperty.getDate() == 12) && - //(dateTimeProperty.getHours() == 0) && + (dateTimeProperty.getDate() == 12) && + (dateTimeProperty.getHours() == 0) && (dateTimeProperty.getMinutes() == 0) && (dateTimeProperty.getSeconds() == 1) && (dateTimeProperty2.getTime() == dateTimeVar2.getTime()) && (dateTimeProperty2.getFullYear() == 2009) && (dateTimeProperty2.getMonth() == 5-1) && - //(dateTimeProperty2.getDate() == 12) && - //(dateTimeProperty2.getHours() == 23) && + (dateTimeProperty2.getDate() == 12) && + (dateTimeProperty2.getHours() == 23) && (dateTimeProperty2.getMinutes() == 59) && (dateTimeProperty2.getSeconds() == 59) } |