feat: format timestamp in TransactionBubble like the Chat
This commit is contained in:
parent
9e2bf87d84
commit
60f7a3cbe2
|
@ -6,12 +6,7 @@ StyledTextEdit {
|
|||
id: chatTime
|
||||
visible: isMessage
|
||||
color: Style.current.darkGrey
|
||||
text: {
|
||||
let messageDate = new Date(Math.floor(timestamp))
|
||||
let minutes = messageDate.getMinutes();
|
||||
let hours = messageDate.getHours();
|
||||
return (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? "0" + minutes : minutes)
|
||||
}
|
||||
text: Utils.formatTime(timestamp)
|
||||
font.pixelSize: 10
|
||||
readOnly: true
|
||||
selectByMouse: true
|
||||
|
|
|
@ -9,7 +9,7 @@ Rectangle {
|
|||
property string fiatValue: "10 USD"
|
||||
property bool outgoing: true
|
||||
property string state: "addressReceived"
|
||||
property string time: "9:41 AM"
|
||||
property int timestamp: 1598454756329
|
||||
|
||||
id: root
|
||||
width: 170
|
||||
|
@ -111,7 +111,7 @@ Rectangle {
|
|||
StyledText {
|
||||
id: timeText
|
||||
color: Style.current.secondaryText
|
||||
text: root.time
|
||||
text: Utils.formatTime(root.timestamp)
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 9
|
||||
anchors.right: parent.right
|
||||
|
|
|
@ -84,4 +84,11 @@ QtObject {
|
|||
function setColorAlpha(color, alpha) {
|
||||
return Qt.hsla(color.hslHue, color.hslSaturation, color.hslLightness, alpha)
|
||||
}
|
||||
|
||||
function formatTime(timestamp) {
|
||||
let messageDate = new Date(Math.floor(timestamp))
|
||||
let minutes = messageDate.getMinutes();
|
||||
let hours = messageDate.getHours();
|
||||
return (hours < 10 ? "0" + hours : hours) + ":" + (minutes < 10 ? "0" + minutes : minutes)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue