diff options
author | Caroline Chao <caroline.chao@digia.com> | 2014-03-05 10:16:10 +0100 |
---|---|---|
committer | Caroline Chao <caroline.chao@digia.com> | 2014-03-05 12:01:07 +0100 |
commit | 150a4b35c958df57dacec0b4ddb6c1fa32f98a53 (patch) | |
tree | df12497cfeca4b68a76cec10c908e6ca60285b2e | |
parent | 91e35620ae0b6868c5c0a240c3ff233a1be9db42 (diff) |
Use the locale format to display the short version of the day name
Not all languages use the three first letters of the day name for the
short version (i.e. Finnish)
Change-Id: I50176e0e27ea93d8b78fbf4298e4ee74d0764c2c
Reviewed-by: Topi Reiniƶ <topi.reinio@digia.com>
-rw-r--r-- | qml/js/utils.js | 6 | ||||
-rw-r--r-- | qml/pages/LongTermDayItem.qml | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/qml/js/utils.js b/qml/js/utils.js index 1ae2cfb..ffe068d 100644 --- a/qml/js/utils.js +++ b/qml/js/utils.js @@ -217,10 +217,12 @@ function extractSymbolUrl(code) // Global -function getDay(index, dayModel) +function getDay(index, dayModel, isShort) { + if (isShort === undefined) + isShort = false var dayDate = new Date(dayModel.date) - return Qt.locale().dayName(dayDate.getDay()) + return Qt.locale().dayName(dayDate.getDay(), isShort ? QtQml.Locale.ShortFormat : QtQml.Locale.LongFormat ) } function getShortDate(date) diff --git a/qml/pages/LongTermDayItem.qml b/qml/pages/LongTermDayItem.qml index bfbcfd9..1a217a3 100644 --- a/qml/pages/LongTermDayItem.qml +++ b/qml/pages/LongTermDayItem.qml @@ -69,7 +69,8 @@ Rectangle { TouchLabel { id: shortDay Layout.preferredWidth: expectedTextWidth("Wed.") - text: Utils.getDay(0, dayModel).substr(0, 3) + property bool useShortFormat: true + text: Utils.getDay(0, dayModel, useShortFormat) font.weight: Font.DemiBold Layout.alignment: Qt.AlignBaseline font.capitalization: Font.Capitalize |