refactor: make use of Qt.locale
This commit is contained in:
parent
eca5622439
commit
f9b7d9dfc9
|
@ -7,7 +7,7 @@ StyledTextEdit {
|
|||
id: chatTime
|
||||
visible: isMessage
|
||||
color: Style.current.darkGrey
|
||||
text: formatDateTime ? Utils.formatDateTime(timestamp) : Utils.formatTime(timestamp)
|
||||
text: formatDateTime ? Utils.formatDateTime(timestamp, appSettings.locale) : Utils.formatTime(timestamp, appSettings.locale)
|
||||
font.pixelSize: Style.current.asideTextFontSize
|
||||
readOnly: true
|
||||
selectByMouse: true
|
||||
|
|
|
@ -119,7 +119,7 @@ Rectangle {
|
|||
|
||||
StyledText {
|
||||
id: contactTime
|
||||
text: Utils.formatDateTime(wrapper.timestamp)
|
||||
text: Utils.formatDateTime(wrapper.timestamp, appSettings.locale)
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: !isCompact ? Style.current.padding : Style.current.smallPadding
|
||||
anchors.top: !isCompact ? parent.top : undefined
|
||||
|
|
|
@ -130,7 +130,7 @@ QtObject {
|
|||
return (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? "0" + minutes : minutes)
|
||||
}
|
||||
|
||||
function formatDateTime(timestamp) {
|
||||
function formatDateTime(timestamp, locale) {
|
||||
let now = new Date()
|
||||
let yesterday = new Date()
|
||||
yesterday.setDate(now.getDate()-1)
|
||||
|
@ -155,7 +155,7 @@ QtObject {
|
|||
qsTr("Saturday")];
|
||||
return days[messageDate.getDay()];
|
||||
} else {
|
||||
return messageDate.getMonth()+1+"/"+messageDate.getDate()+"/"+messageDate.getFullYear()
|
||||
return new Date().toLocaleDateString(Qt.locale(locale))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue