diff --git a/rotator.js b/rotator.js index 00d79fd..870d4e3 100644 --- a/rotator.js +++ b/rotator.js @@ -206,7 +206,9 @@ async function sourceCounts(owner, days) { } // a source was deleted: its links go back to having none async function detachSource(owner, sid) { let n = 0; for (const r of J.db.rotations) if (r.owner === norm(owner) && r.sourceId === String(sid)) { delete r.sourceId; n++; } if (n) J.save(); return n; } -const ctDay = ts => new Date(ts).toLocaleDateString('en-CA', { timeZone: 'America/Chicago' }); +// shared formatter: toLocaleDateString(..., {timeZone}) builds a new Intl formatter per call (slow per hit; 2026-10-14) +const CT_DAY_FMT = new Intl.DateTimeFormat('en-CA', { timeZone: 'America/Chicago', year: 'numeric', month: '2-digit', day: '2-digit' }); +const ctDay = ts => CT_DAY_FMT.format(new Date(ts)); // one view across everything a member owns, for Reports async function summary(owner, days) { const mine = J.db.rotations.filter(r => r.owner === norm(owner)); const ids = new Set(mine.map(r => r.id));