mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
DateTime: proper locale usage. Fix #390
Replaced all Qt.formatDateTime() by Qt.locale().toString()
This commit is contained in:
@@ -61,7 +61,7 @@ Rectangle {
|
||||
spacing: Settings.data.bar.showCapsule ? -4 * scaling : -2 * scaling
|
||||
Repeater {
|
||||
id: repeater
|
||||
model: Qt.formatDateTime(now, formatHorizontal.trim()).split("\\n")
|
||||
model: Qt.locale().toString(now, formatHorizontal.trim()).split("\\n")
|
||||
NText {
|
||||
visible: text !== ""
|
||||
text: modelData
|
||||
@@ -91,7 +91,7 @@ Rectangle {
|
||||
anchors.centerIn: parent
|
||||
spacing: -2 * scaling
|
||||
Repeater {
|
||||
model: Qt.formatDateTime(now, formatVertical.trim()).split(" ")
|
||||
model: Qt.locale().toString(now, formatVertical.trim()).split(" ")
|
||||
delegate: NText {
|
||||
visible: text !== ""
|
||||
text: modelData
|
||||
|
||||
@@ -88,7 +88,7 @@ NBox {
|
||||
NText {
|
||||
text: {
|
||||
var weatherDate = new Date(LocationService.data.weather.daily.time[index].replace(/-/g, "/"))
|
||||
return Qt.formatDateTime(weatherDate, "ddd")
|
||||
return Qt.locale().toString(weatherDate, "ddd")
|
||||
}
|
||||
color: Color.mOnSurface
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
|
||||
@@ -27,12 +27,12 @@ Loader {
|
||||
}
|
||||
|
||||
function formatTime() {
|
||||
return Settings.data.location.use12hourFormat ? Qt.formatDateTime(new Date(), "h:mm A") : Qt.formatDateTime(new Date(), "HH:mm")
|
||||
return Settings.data.location.use12hourFormat ? Qt.locale().toString(new Date(), "h:mm A") : Qt.locale().toString(new Date(), "HH:mm")
|
||||
}
|
||||
|
||||
function formatDate() {
|
||||
// For full text date, day is always before month, so we use this format for everybody: Wednesday, September 17.
|
||||
return Qt.formatDateTime(new Date(), "dddd, MMMM d")
|
||||
return Qt.locale().toString(new Date(), "dddd, MMMM d")
|
||||
}
|
||||
|
||||
function scheduleUnloadAfterUnlock() {
|
||||
|
||||
@@ -182,7 +182,7 @@ ColumnLayout {
|
||||
// Horizontal
|
||||
Repeater {
|
||||
Layout.topMargin: Style.marginM * scaling
|
||||
model: Qt.formatDateTime(now, valueFormatHorizontal.trim()).split("\\n")
|
||||
model: Qt.locale().toString(now, valueFormatHorizontal.trim()).split("\\n")
|
||||
delegate: NText {
|
||||
visible: text !== ""
|
||||
text: modelData
|
||||
@@ -213,7 +213,7 @@ ColumnLayout {
|
||||
|
||||
Repeater {
|
||||
Layout.topMargin: Style.marginM * scaling
|
||||
model: Qt.formatDateTime(now, valueFormatVertical.trim()).split(" ")
|
||||
model: Qt.locale().toString(now, valueFormatVertical.trim()).split(" ")
|
||||
delegate: NText {
|
||||
visible: text !== ""
|
||||
text: modelData
|
||||
|
||||
@@ -312,7 +312,7 @@ Rectangle {
|
||||
|
||||
NText {
|
||||
anchors.centerIn: parent
|
||||
text: Qt.formatDateTime(root.sampleDate, modelData.token)
|
||||
text: Qt.locale().toString(root.sampleDate, modelData.token)
|
||||
color: tokenMouseArea.containsMouse ? Color.mOnPrimary : Color.mSurfaceVariant
|
||||
font.pointSize: Style.fontSizeS * scaling
|
||||
|
||||
|
||||
Reference in New Issue
Block a user