/** "2h 05m", "4m 12s", "38s" — compact remaining time until `iso`, never negative. */ export function untilLabel(iso: string, now = Date.now()): string { const total = Math.max(0, Math.round((new Date(iso).getTime() - now) / 1000)); const d = Math.floor(total / 86_400); const h = Math.floor((total % 86_400) / 3600); const m = Math.floor((total % 3600) / 60); const s = total % 60; if (d > 0) return `${d}d ${h}h`; if (h > 0) return `${h}h ${String(m).padStart(2, '0')}m`; if (m > 0) return `${m}m ${String(s).padStart(2, '0')}s`; return `${s}s`; }