Don't try negative numbers when translating "%n second(s) ago"-style strings

When the local clock is running behind,
transactions may appear to have been confirmed in the future,
which seems to leave the %n in "%n second(s) ago" unreplaced,
so round negative times ago to 0

Ref: #3284
This commit is contained in:
наб
2025-11-15 21:40:27 +01:00
parent b9eea25e52
commit 1cce66f866

View File

@@ -53,7 +53,7 @@ function ago(epoch) {
// Returns '<delta> [seconds|minutes|hours|days] ago' string given an epoch
var now = new Date().getTime() / 1000;
var delta = now - epoch;
var delta = Math.max(now - epoch, 0);
if(delta < 60)
return qsTr("%n second(s) ago", "0", Math.floor(delta))