Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.0.0
-
None
Description
The following unit test fails in QtQml:
FAIL! : tst_qqmlecmascript::assignDate(Component.onComplete JS) Compared values are not the same Actual (object->dateProperty()): 1982/11/24 Expected (QDate(1982, 11, 25)): 1982/11/25 Loc: [/home/thiago/src/qt/qt5/qtdeclarative/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp(350)]
Note that the source file for the property in question is (assignDate.qml):
dateProperty = new Date("1982-11-25")
Note that the the test above in the same file is correct, with the source (assignBasicTypes.qml):
dateProperty = "1982-11-25"
From what I can tell in the source, the latter uses QDateTime::fromString. I'm guessing the former is going through a JS Date object, which is supposed to represent a full date, time and timezone. The JS date is the locale date of "1982-11-25" (no Z, so it's locale), but it must have been interpreted as midnight Zulu time, which yields 1982-11-24T22:00-0200 localtime. When the QDate is extracted from that QDateTime, the date is wrong.
Attachments
Issue Links
- relates to
-
QTBUG-29328 Incorrect conversion of JavaScript date from C++
- Closed
For Gerrit Dashboard: QTBUG-25262 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
23124,1 | Record current status of date conversion from QML | master | qt/qtdeclarative | Status: MERGED | +2 | 0 |
24156,2 | Verify that QML can reliably receive datetime info from C++ | master | qt/qtdeclarative | Status: MERGED | +2 | 0 |