aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/jsruntime/qv4dateobject.cpp2
-rw-r--r--tests/auto/qml/qqmlecmascript/data/checkDateTime-nonstandardFormat.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 447f5b9661..19ae62f054 100644
--- a/src/qml/jsruntime/qv4dateobject.cpp
+++ b/src/qml/jsruntime/qv4dateobject.cpp
@@ -631,6 +631,8 @@ static inline double ParseString(const QString &s, double localTZA)
QStringLiteral("d MMMM, yyyy"),
QStringLiteral("d MMMM, yyyy hh:mm"),
QStringLiteral("d MMMM, yyyy hh:mm:ss"),
+
+ QStringLiteral("yyyy-MM-dd hh:mm:ss t"),
};
for (const QString &format : formats) {
diff --git a/tests/auto/qml/qqmlecmascript/data/checkDateTime-nonstandardFormat.qml b/tests/auto/qml/qqmlecmascript/data/checkDateTime-nonstandardFormat.qml
new file mode 100644
index 0000000000..9c2e6a7f88
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/checkDateTime-nonstandardFormat.qml
@@ -0,0 +1,10 @@
+import Qt.test 1.0
+import QtQml 2.15
+
+
+MyTypeObject {
+ Component.onCompleted: {
+ dateTimeProperty = new Date("1991-08-25 20:57:08 GMT+0000")
+ boolProperty = !Number.isNaN(dateTimeProperty)
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index e3396a430f..3ab7b45b2a 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -677,6 +677,9 @@ void tst_qqmlecmascript::checkDateTime_data()
QTest::newRow("October")
<< testFileUrl("checkDateTime-October.qml")
<< QDateTime(QDate(2019, 10, 3), QTime(12, 0), Qt::LocalTime);
+ 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");
}
void tst_qqmlecmascript::checkDateTime()