Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.3.2
-
None
-
Windows 7 - MinGW 4.8.2
-
4e7c588f027f6a846fc343975bc8bcce5f69f6ff
Description
The Date().toLocaleString() method does not what is described in the documenation. It seems that all arguments are ignored, it produces the same output as Date().toString().
Workaround: Using Qt.formatDateTime() instead.
The following code produced the output in the image:
Unable to find source-code formatter for language: qml. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
import QtQuick 2.2 Rectangle { width: 360 height: 360 Column { anchors.centerIn: parent Text { text: Qt.formatDateTime(new Date, "dd.MM.yyyy hh:mm:ss") } Text { text: Date().toLocaleString(Qt.locale(), "dd.MM.yyyy hh:mm:ss") } Text { text: Date().toLocaleString(Qt.locale(), Locale.ShortFormat) } Text { text: Date().toLocaleString(Qt.locale("en_US"), Locale.LongFormat) } Text { text: Date().toLocaleString(Qt.locale("de_DE"), Locale.LongFormat) } Text { text: Date().toLocaleString(Qt.locale("de_DE")) } } }