diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2018-04-19 14:50:37 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2018-07-03 11:24:57 +0000 |
commit | a686fe7000df64026cc6059645c198141f565e15 (patch) | |
tree | 5173def2ed12eb65da0f174a7d59a779e1ca5efb | |
parent | fc01254cf89543e509e8ebaca93aac7f009247dd (diff) |
Apply TimeClip() in a few places it was missing
When parsing or converting from a QDateTime, we didn't always check
that the resulting Date object was within range (1e8 days either side
of the start of 1970).
Change-Id: I1bee69f9070829f68998d576c19907a827fabc39
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r-- | src/qml/jsruntime/qv4dateobject.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp index 474c58d3fd..43947c8e6d 100644 --- a/src/qml/jsruntime/qv4dateobject.cpp +++ b/src/qml/jsruntime/qv4dateobject.cpp @@ -533,7 +533,7 @@ static inline double ParseString(const QString &s, double localTZA) else if (seenT) // No zone specified, treat date-time as local time t = UTC(t, localTZA); // else: treat plain date as already in UTC - return t; + return TimeClip(t); } QDateTime dt = QDateTime::fromString(s, Qt::TextDate); @@ -603,7 +603,7 @@ static inline double ParseString(const QString &s, double localTZA) } if (!dt.isValid()) return qt_qnan(); - return dt.toMSecsSinceEpoch(); + return TimeClip(dt.toMSecsSinceEpoch()); } /*! @@ -703,7 +703,7 @@ DEFINE_OBJECT_VTABLE(DateObject); void Heap::DateObject::init(const QDateTime &date) { Object::init(); - this->date = date.isValid() ? date.toMSecsSinceEpoch() : qt_qnan(); + this->date = date.isValid() ? TimeClip(date.toMSecsSinceEpoch()) : qt_qnan(); } void Heap::DateObject::init(const QTime &time) |