From fe046274934fa936ff5b180ae720cb5337e0583f Mon Sep 17 00:00:00 2001 From: Waters Church Date: Tue, 15 Sep 2026 09:58:47 -0400 Subject: [PATCH] PCO Plan: "Starts in" counts days past 24 hours MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A service more than a day away reads "2 Days, 05:12:44" (or "1 Day, …") in the top bar's countdown instead of a growing hour count; under a day it reads as before. Co-Authored-By: Claude Fable 5.1 --- modules/pco-plan/client.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/pco-plan/client.js b/modules/pco-plan/client.js index 34f30e2..7bf08f4 100644 --- a/modules/pco-plan/client.js +++ b/modules/pco-plan/client.js @@ -89,6 +89,16 @@ export default function create({ root, moduleApi }) { return `${sign}${m}:${String(sec).padStart(2, '0')}`; } + /** "Starts in": under a day like fmtDur; a day or more reads "2 Days, 05:12:44". */ + function fmtStartsIn(totalSec) { + const s = Math.max(0, Math.round(totalSec)); + const days = Math.floor(s / 86400); + if (!days) return fmtDur(s); + const rest = s % 86400; + const pad = (v) => String(v).padStart(2, '0'); + return `${days} ${days === 1 ? 'Day' : 'Days'}, ${pad(Math.floor(rest / 3600))}:${pad(Math.floor((rest % 3600) / 60))}:${pad(rest % 60)}`; + } + function fmtMinutes(totalSec) { const m = Math.round(totalSec / 60); if (m < 60) return `${m} min`; @@ -261,7 +271,7 @@ export default function create({ root, moduleApi }) { const startsAt = svc.startsAt || plan.serviceStartsAt || 0; if (on('showCountdown') && startsAt > now) { clockLabelEl.textContent = 'Starts in'; - clockValueEl.textContent = fmtDur((startsAt - now) / 1000); + clockValueEl.textContent = fmtStartsIn((startsAt - now) / 1000); return; } if (on('showRunningClock') && startsAt) {