From 75cc767b58866ccdc1008a784d9fb1f84f992df8 Mon Sep 17 00:00:00 2001 From: Zerebos Date: Sun, 17 May 2026 04:11:33 -0400 Subject: [PATCH] Expiry formatting change --- .../settings/sections/DevtoolsSettings.svelte | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/features/settings/sections/DevtoolsSettings.svelte b/src/features/settings/sections/DevtoolsSettings.svelte index 7c65b00..b9c2a50 100644 --- a/src/features/settings/sections/DevtoolsSettings.svelte +++ b/src/features/settings/sections/DevtoolsSettings.svelte @@ -33,10 +33,22 @@ function fmtCountdown(ms: number | null): string { if (ms === null) return "—"; if (ms <= 0) return "expired"; + const total = Math.floor(ms / 1000); + const month = 30 * 24 * 60 * 60; + const day = 24 * 60 * 60; + const hour = 60 * 60; + const minute = 60; + + const months = Math.floor(total / month); + const days = Math.floor((total % month) / day); const hours = Math.floor(total / 3600); - const mins = Math.floor((total % 3600) / 60); + const remainingHours = Math.floor((total % day) / hour); + const mins = Math.floor((total % hour) / minute); const secs = total % 60; + + if (months > 0) return days > 0 ? `${months}mo ${days}d` : `${months}mo`; + if (days > 0) return remainingHours > 0 ? `${days}d ${remainingHours}h` : `${days}d`; if (hours > 0) return `${hours}h ${mins}m ${secs}s`; if (mins > 0) return `${mins}m ${secs}s`; return `${secs}s`;