diff options
| author | Adam Malczewski <[email protected]> | 2026-05-21 13:19:33 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-05-21 13:19:33 +0900 |
| commit | 031f949b2eaccd6424d5e20fb5a1f1ffecfac0ba (patch) | |
| tree | b683481d1bf1d9e989aa3c010b4a7be59939eda6 | |
| parent | 43972af94d75bf0c5f5bbbf9a354ec1f4cf96d47 (diff) | |
| download | dispatch-031f949b2eaccd6424d5e20fb5a1f1ffecfac0ba.tar.gz dispatch-031f949b2eaccd6424d5e20fb5a1f1ffecfac0ba.zip | |
feat: show countdown for resets within 48h (e.g. 'in 5:30')
| -rw-r--r-- | packages/frontend/src/lib/components/KeyUsage.svelte | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/frontend/src/lib/components/KeyUsage.svelte b/packages/frontend/src/lib/components/KeyUsage.svelte index 9dc7a20..e7c6dee 100644 --- a/packages/frontend/src/lib/components/KeyUsage.svelte +++ b/packages/frontend/src/lib/components/KeyUsage.svelte @@ -121,6 +121,12 @@ } function formatDate(ts: number): string { + const diff = ts - Date.now(); + if (diff > 0 && diff < 48 * 60 * 60 * 1000) { + const hours = Math.floor(diff / 3600000); + const minutes = Math.floor((diff % 3600000) / 60000); + return `in ${hours}:${String(minutes).padStart(2, "0")}`; + } return new Date(ts).toLocaleString(); } |
