[Interest] "Proper" Date Locale support?

Ulf Hermann ulf.hermann at qt.io
Tue Jun 7 10:15:22 CEST 2016


> I'm working with localization of dates. There is a standard JS API:
> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString#Using_options
>
> But QML defines it's own Date:
> http://doc.qt.io/qt-5/qml-qtqml-date.html
>
> The difference being the MDN refers to an "options" object, and Qt uses a format string. With the update to a newer V8 engine, will we get the options behavior?

The QML Date type extends the JavaScript Date object. So, the locales/options variant of toLocaleString() would have to be implemented in the JavaScript engine, which is not V8 but our own "V4". Be aware that the QML Date's toLocaleString() method hides the JavaScript method of the same name in QML Date objects. So, in addition we'd have to somehow autodetect the arguments format when the QML method is called.

regards,
Ulf



More information about the Interest mailing list