diff options
| author | Danilo M. <danix@danix.xyz> | 2026-11-28 09:10:53 +0100 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-11-28 09:10:53 +0100 |
| commit | 258fbbb987ed738c76c5c8d05dcc3cdfbbc06406 (patch) | |
| tree | 3180cc42b0d804cdef0008aa85cf9e75ddf7c61e | |
| parent | 4b9d9661751379ea62ebdc2587dff20544c4ada4 (diff) | |
| download | deck-it-258fbbb987ed738c76c5c8d05dcc3cdfbbc06406.tar.gz deck-it-258fbbb987ed738c76c5c8d05dcc3cdfbbc06406.zip | |
fix(vm): a snapshot with no time shows no age, not "just now"
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| -rw-r--r-- | static/modules/vm.js | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/static/modules/vm.js b/static/modules/vm.js index b6c1a92..c8e9676 100644 --- a/static/modules/vm.js +++ b/static/modules/vm.js @@ -57,6 +57,7 @@ function powerFor(st) { } function ago(sec) { + if (!Number.isFinite(sec) || sec <= 0) return ""; // no time is not "just now" const s = Math.max(0, Date.now() / 1000 - sec); for (const [n, u] of [[31536000, "y"], [2592000, "mo"], [86400, "d"], [3600, "h"], [60, "min"]]) { if (s >= n) return `${Math.floor(s / n)} ${u} ago`; |
