aboutsummaryrefslogtreecommitdiffstats
path: root/dependencies.yaml
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2023-01-12 10:04:49 +0100
committerUlf Hermann <ulf.hermann@qt.io>2023-01-17 21:58:32 +0100
commit5bc63de8819448e7342f3cb0ac08af667ccc81e5 (patch)
treeb68b1bc0945743e1b9f0924b9538f872875ac63e /dependencies.yaml
parent330c3e91eeed631e084b68454c3fbc248a1b4bb1 (diff)
QML: Add more overloads to Qt.format{Date|Time|DateTime}()
Since JavaScript has no concept of time or date separate from the Date object that contains both, and since we implicitly (via QVariant::convert) or explicitly accept string arguments to all these methods, we should really accept string coercions of Date objects. We should also make all the string overloads explicit. Converting strings to QDateTime is a really obscure feature of the metatype system. We should not rely on it. Furthermore, we need to accept QDateTime, as the native representation of the JavaScript Date object, as argument to formatDate() and formatTime(). Otherwise there are two ambiguous paths to calling formatTime() or formatDate() using a Date object: Either coerce the Date into a string and call the string overload or coerce it into a QTime or QDate and call the QTime or QDate overload. The QML engine special cases this and prefers the QTime/QDate way, but this just needlessly complicates the overload resolution. Interestingly, tst_qqmlqt already tests most of those variants. We just have to add the JS string coercions. Task-number: QTBUG-109380 Change-Id: I880e622256fe115dade32bde880605df2031ff2f Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Diffstat (limited to 'dependencies.yaml')
0 files changed, 0 insertions, 0 deletions