From 7ac3dfc2d1827e2bdba48de04725e7d7975d97d3 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 1 Feb 2022 14:31:42 +0100 Subject: V4 Date: Support another nonstandard date format QDateTime has dropped Amends commit 43eaa77e8ed03153335c0002dcc8b660c39a0beb. Fixes: QTBUG-100377 Change-Id: I01028bd991b8a64bd9dcad31ce90536d83dad0a1 Reviewed-by: Fabian Kosmale Reviewed-by: Edward Welbourne Reviewed-by: Andrei Golubev (cherry picked from commit 41a5c7b223d958bd40240aee81bb8fb96540735d) Reviewed-by: Qt Cherry-pick Bot --- .../qqmlecmascript/data/checkDateTime-nonstandardFormat2.qml | 10 ++++++++++ tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 3 +++ 2 files changed, 13 insertions(+) create mode 100644 tests/auto/qml/qqmlecmascript/data/checkDateTime-nonstandardFormat2.qml (limited to 'tests') 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 9b1329d15d..7ea5ef6e4b 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -730,6 +730,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() -- cgit v1.2.3