Rotator: shared Central-day formatter in summary (toLocaleDateString with timeZone built a formatter per hit; the status strip took ~4 s)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-10-14 17:08:05 -05:00
parent 1c400bd87d
commit f47c4ecd54
+3 -1
View File
@@ -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));