aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4dateobject.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2018-04-19 15:23:58 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2018-07-03 11:25:25 +0000
commit4d3d3e1099d628479929ab293d267016bb183c96 (patch)
treed37e47489edc83462a43038d28e6249c45a4f99a /src/qml/jsruntime/qv4dateobject.cpp
parenta686fe7000df64026cc6059645c198141f565e15 (diff)
Fix handling of out-of-range year in Date's toISOString()
ECMAScript 2015 clarified the handling of out-of-range years, requiring that an exception be raised: http://www.ecma-international.org/ecma-262/7.0/index.html#sec-corrections-and-clarifications-in-ecmascript-2015-with-possible-compatibility-impact http://www.ecma-international.org/ecma-262/7.0/index.html#sec-date.prototype.toisostring Change-Id: I91d76703705f3919d2ee77557e36af362db1adf9 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4dateobject.cpp')
-rw-r--r--src/qml/jsruntime/qv4dateobject.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp
index 43947c8e6d..3efd626685 100644
--- a/src/qml/jsruntime/qv4dateobject.cpp
+++ b/src/qml/jsruntime/qv4dateobject.cpp
@@ -1470,7 +1470,7 @@ ReturnedValue DatePrototype::method_toISOString(const FunctionObject *b, const V
int year = (int)YearFromTime(t);
if (year < 0 || year > 9999) {
if (qAbs(year) >= 1000000)
- RETURN_RESULT(v4->newString(QStringLiteral("Invalid Date")));
+ RETURN_RESULT(v4->throwRangeError(*thisObject));
result += year < 0 ? QLatin1Char('-') : QLatin1Char('+');
year = qAbs(year);
addZeroPrefixedInt(result, year, 6);