diff options
author | Andrew den Exter <andrew.den-exter@nokia.com> | 2012-03-21 12:47:15 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-21 04:05:38 +0100 |
commit | b2722ab31e524fc223a332fc0574e4b66c716b20 (patch) | |
tree | 00c52bd1520249db35339b5c052cb064d8e6869c /src/qml/qml/qqmlstringconverters.cpp | |
parent | d6bc3b59077bf5d9e0cb734d093e0f354cee096c (diff) |
Fix consistency of parsing ISO 8601 date strings.
Use the UTC timespec for strings with no time zone qualifier as V8 does
so we don't get different QDateTime in bindings depending on whether
the string was bound directly, or parsed by constructing a new JS
Date object.
Task-number: QTBUG-24895
Change-Id: I8f74dae418aaeeaf06df33fe58ab4e3e3fea791b
Reviewed-by: Chris Adams <christopher.adams@nokia.com>
Diffstat (limited to 'src/qml/qml/qqmlstringconverters.cpp')
-rw-r--r-- | src/qml/qml/qqmlstringconverters.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlstringconverters.cpp b/src/qml/qml/qqmlstringconverters.cpp index 2c7f6c9f6e..82f4f7db03 100644 --- a/src/qml/qml/qqmlstringconverters.cpp +++ b/src/qml/qml/qqmlstringconverters.cpp @@ -174,6 +174,9 @@ QDateTime QQmlStringConverters::dateTimeFromString(const QString &s, bool *ok) { QDateTime d = QDateTime::fromString(s, Qt::ISODate); if (ok) *ok = d.isValid(); + // V8 never parses a date string as local time. For consistency do the same here. + if (d.timeSpec() == Qt::LocalTime) + d.setTimeSpec(Qt::UTC); return d; } #endif // QT_NO_DATESTRING |