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