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:
parent
6c32ebf7e6
commit
e5e481f836
6 changed files with 18 additions and 9 deletions
2
lnbits/static/bundle.min.js
vendored
2
lnbits/static/bundle.min.js
vendored
File diff suppressed because one or more lines are too long
|
|
@ -468,7 +468,10 @@ window.AdminPageLogic = {
|
||||||
.catch(LNbits.utils.notifyApiError)
|
.catch(LNbits.utils.notifyApiError)
|
||||||
},
|
},
|
||||||
formatDate(date) {
|
formatDate(date) {
|
||||||
return moment.utc(date * 1000).fromNow()
|
return moment
|
||||||
|
.utc(date * 1000)
|
||||||
|
.local()
|
||||||
|
.fromNow()
|
||||||
},
|
},
|
||||||
sendTestEmail() {
|
sendTestEmail() {
|
||||||
LNbits.api
|
LNbits.api
|
||||||
|
|
|
||||||
|
|
@ -267,10 +267,10 @@ window.LNbits = {
|
||||||
}
|
}
|
||||||
|
|
||||||
obj.date = moment.utc(data.created_at).local().format(window.dateFormat)
|
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.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.msat = obj.amount
|
||||||
obj.sat = obj.msat / 1000
|
obj.sat = obj.msat / 1000
|
||||||
obj.tag = obj.extra?.tag
|
obj.tag = obj.extra?.tag
|
||||||
|
|
|
||||||
|
|
@ -600,7 +600,7 @@ window.app.component('lnbits-date', {
|
||||||
return LNbits.utils.formatDate(this.ts)
|
return LNbits.utils.formatDate(this.ts)
|
||||||
},
|
},
|
||||||
dateFrom() {
|
dateFrom() {
|
||||||
return moment.utc(this.date).fromNow()
|
return moment.utc(this.date).local().fromNow()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
template: `
|
template: `
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ window.PaymentsPageLogic = {
|
||||||
if (p.extra && p.extra.tag) {
|
if (p.extra && p.extra.tag) {
|
||||||
p.tag = 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.outgoing = p.amount < 0
|
||||||
p.amount =
|
p.amount =
|
||||||
new Intl.NumberFormat(window.LOCALE).format(p.amount / 1000) +
|
new Intl.NumberFormat(window.LOCALE).format(p.amount / 1000) +
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ window.WalletPageLogic = {
|
||||||
methods: {
|
methods: {
|
||||||
dateFromNow(unix) {
|
dateFromNow(unix) {
|
||||||
const date = new Date(unix * 1000)
|
const date = new Date(unix * 1000)
|
||||||
return moment.utc(date).fromNow()
|
return moment.utc(date).local().fromNow()
|
||||||
},
|
},
|
||||||
formatFiatAmount(amount, currency) {
|
formatFiatAmount(amount, currency) {
|
||||||
this.update.currency = currency
|
this.update.currency = currency
|
||||||
|
|
@ -476,8 +476,14 @@ window.WalletPageLogic = {
|
||||||
createdDate,
|
createdDate,
|
||||||
'YYYY-MM-DDTHH:mm:ss.SSSZ'
|
'YYYY-MM-DDTHH:mm:ss.SSSZ'
|
||||||
)
|
)
|
||||||
cleanInvoice.expireDateFrom = moment.utc(expireDate).fromNow()
|
cleanInvoice.expireDateFrom = moment
|
||||||
cleanInvoice.createdDateFrom = moment.utc(createdDate).fromNow()
|
.utc(expireDate)
|
||||||
|
.local()
|
||||||
|
.fromNow()
|
||||||
|
cleanInvoice.createdDateFrom = moment
|
||||||
|
.utc(createdDate)
|
||||||
|
.local()
|
||||||
|
.fromNow()
|
||||||
|
|
||||||
cleanInvoice.expired = false // TODO
|
cleanInvoice.expired = false // TODO
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue