fix: correct timezone handling for transaction timestamps (#3373)

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Vlad Stan <stan.v.vlad@gmail.com>
This commit is contained in:
Ben Weeks
2025-10-06 10:53:03 +02:00
committed by GitHub
co-authored by Claude Vlad Stan
parent 6c32ebf7e6
commit e5e481f836
6 changed files with 18 additions and 9 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+4 -1
View File
@@ -468,7 +468,10 @@ window.AdminPageLogic = {
.catch(LNbits.utils.notifyApiError)
},
formatDate(date) {
return moment.utc(date * 1000).fromNow()
return moment
.utc(date * 1000)
.local()
.fromNow()
},
sendTestEmail() {
LNbits.api
+2 -2
View File
@@ -267,10 +267,10 @@ window.LNbits = {
}
obj.date = moment.utc(data.created_at).local().format(window.dateFormat)
obj.dateFrom = moment.utc(data.created_at).fromNow()
obj.dateFrom = moment.utc(data.created_at).local().fromNow()
obj.expirydate = moment.utc(obj.expiry).local().format(window.dateFormat)
obj.expirydateFrom = moment.utc(obj.expiry).fromNow()
obj.expirydateFrom = moment.utc(obj.expiry).local().fromNow()
obj.msat = obj.amount
obj.sat = obj.msat / 1000
obj.tag = obj.extra?.tag
+1 -1
View File
@@ -600,7 +600,7 @@ window.app.component('lnbits-date', {
return LNbits.utils.formatDate(this.ts)
},
dateFrom() {
return moment.utc(this.date).fromNow()
return moment.utc(this.date).local().fromNow()
}
},
template: `
+1 -1
View File
@@ -164,7 +164,7 @@ window.PaymentsPageLogic = {
if (p.extra && p.extra.tag) {
p.tag = p.extra.tag
}
p.timeFrom = moment.utc(p.created_at).fromNow()
p.timeFrom = moment.utc(p.created_at).local().fromNow()
p.outgoing = p.amount < 0
p.amount =
new Intl.NumberFormat(window.LOCALE).format(p.amount / 1000) +
+9 -3
View File
@@ -179,7 +179,7 @@ window.WalletPageLogic = {
methods: {
dateFromNow(unix) {
const date = new Date(unix * 1000)
return moment.utc(date).fromNow()
return moment.utc(date).local().fromNow()
},
formatFiatAmount(amount, currency) {
this.update.currency = currency
@@ -476,8 +476,14 @@ window.WalletPageLogic = {
createdDate,
'YYYY-MM-DDTHH:mm:ss.SSSZ'
)
cleanInvoice.expireDateFrom = moment.utc(expireDate).fromNow()
cleanInvoice.createdDateFrom = moment.utc(createdDate).fromNow()
cleanInvoice.expireDateFrom = moment
.utc(expireDate)
.local()
.fromNow()
cleanInvoice.createdDateFrom = moment
.utc(createdDate)
.local()
.fromNow()
cleanInvoice.expired = false // TODO
}