feat: format timestamp in TransactionBubble like the Chat
This commit is contained in:
parent
9e2bf87d84
commit
60f7a3cbe2
|
@ -6,12 +6,7 @@ StyledTextEdit {
|
||||||
id: chatTime
|
id: chatTime
|
||||||
visible: isMessage
|
visible: isMessage
|
||||||
color: Style.current.darkGrey
|
color: Style.current.darkGrey
|
||||||
text: {
|
text: Utils.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)
|
|
||||||
}
|
|
||||||
font.pixelSize: 10
|
font.pixelSize: 10
|
||||||
readOnly: true
|
readOnly: true
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
|
|
|
@ -9,7 +9,7 @@ Rectangle {
|
||||||
property string fiatValue: "10 USD"
|
property string fiatValue: "10 USD"
|
||||||
property bool outgoing: true
|
property bool outgoing: true
|
||||||
property string state: "addressReceived"
|
property string state: "addressReceived"
|
||||||
property string time: "9:41 AM"
|
property int timestamp: 1598454756329
|
||||||
|
|
||||||
id: root
|
id: root
|
||||||
width: 170
|
width: 170
|
||||||
|
@ -111,7 +111,7 @@ Rectangle {
|
||||||
StyledText {
|
StyledText {
|
||||||
id: timeText
|
id: timeText
|
||||||
color: Style.current.secondaryText
|
color: Style.current.secondaryText
|
||||||
text: root.time
|
text: Utils.formatTime(root.timestamp)
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.bottomMargin: 9
|
anchors.bottomMargin: 9
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
|
@ -84,4 +84,11 @@ QtObject {
|
||||||
function setColorAlpha(color, alpha) {
|
function setColorAlpha(color, alpha) {
|
||||||
return Qt.hsla(color.hslHue, color.hslSaturation, color.hslLightness, 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