[Development] QML Basic types: date and time

Mitch Curtis mitch.curtis at digia.com
Fri Aug 2 13:01:47 CEST 2013


In light of [1], I'm beginning to wonder what the purpose of QML's basic 
date [2] and time [3] types are. The time type can't be used, and the 
date type can be replaced with var, since it is implicitly converted to 
a Date object [4] (JS Date object with QML locale extensions) anyway:

import QtQuick 2.0

Item {
     Timer {
         running: true
         interval: 100
         onTriggered: Qt.quit();

     property date basicDate: "2012-12-31"
     property var date: new Date("2012-12-31")

     Component.onCompleted: {
         print(basicDate.getFullYear()); // Implicitly converted to Date 
         print(date.getFullYear()); // Why not just use this?

Do we need these types? If not, can we deprecate them in 5.2?


[1] https://bugreports.qt-project.org/browse/QTBUG-32295
[2] http://doc-snapshot.qt-project.org/qt5-stable/qtqml/qml-date.html
[3] http://doc-snapshot.qt-project.org/qt5-stable/qtqml/qml-time.html
[4] http://doc-snapshot.qt-project.org/qt5-stable/qtqml/qml-qtqml2-date.html

More information about the Development mailing list