aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/jsruntime/qv4dateobject.cpp2
-rw-r--r--tests/auto/qml/qqmlecmascript/data/checkDateTime-nonstandardFormat2.qml10
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp3
3 files changed, 15 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp
index 3b8c95009a..12225d3866 100644
--- a/src/qml/jsruntime/qv4dateobject.cpp
+++ b/src/qml/jsruntime/qv4dateobject.cpp
@@ -650,7 +650,9 @@ static inline double ParseString(const QString &s, double localTZA)
QStringLiteral("d MMMM, yyyy hh:mm"),
QStringLiteral("d MMMM, yyyy hh:mm:ss"),
+ // ISO 8601 and RFC 2822 with a GMT as prefix on its offset, or GMT as zone.
QStringLiteral("yyyy-MM-dd hh:mm:ss t"),
+ QStringLiteral("ddd, d MMM yyyy hh:mm:ss t"),
};
for (const QString &format : formats) {
diff --git a/tests/auto/qml/qqmlecmascript/data/checkDateTime-nonstandardFormat2.qml b/tests/auto/qml/qqmlecmascript/data/checkDateTime-nonstandardFormat2.qml
new file mode 100644
index 0000000000..3fd3c05024
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/checkDateTime-nonstandardFormat2.qml
@@ -0,0 +1,10 @@
+import Qt.test 1.0
+import QtQml 2.15
+
+
+MyTypeObject {
+ Component.onCompleted: {
+ dateTimeProperty = new Date("Sun, 25 Mar 2018 11:10:49 GMT")
+ boolProperty = !Number.isNaN(dateTimeProperty)
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 7e539b3473..2216bc52ce 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -726,6 +726,9 @@ void tst_qqmlecmascript::checkDateTime_data()
QTest::newRow("nonstandard-format")
<< testFileUrl("checkDateTime-nonstandardFormat.qml")
<< QDateTime::fromString("1991-08-25 20:57:08 GMT+0000", "yyyy-MM-dd hh:mm:ss t");
+ QTest::newRow("nonstandard-format2")
+ << testFileUrl("checkDateTime-nonstandardFormat2.qml")
+ << QDateTime::fromString("Sun, 25 Mar 2018 11:10:49 GMT", "ddd, d MMM yyyy hh:mm:ss t");
}
void tst_qqmlecmascript::checkDateTime()