Per-tournament time zone for all clock times (Central by default)

Release 0.6.1.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MB7nCCAscYsb3zzkT6LHZi
This commit is contained in:
bkvargyasandClaude Fable 5.1 committed 2026-09-06 03:54:48 +00:00
1 parent 103c221a12
commit 110077314d
10 files changed
+40 -11

No files matched your search

+5 -1
View File
@@ -1,4 +1,8 @@
// The one JSON document every public page renders from. No phone numbers, no team codes.
export const DEFAULT_TZ = process.env.DEFAULT_TIMEZONE || 'America/Chicago';
export function validTz(tz) { try { new Intl.DateTimeFormat('en-US', { timeZone: tz }); return tz; } catch { return null; } }
export const tzOf = t => validTz(t.timezone) ?? DEFAULT_TZ;
export const fmtTime = (ms, tz) => new Date(ms).toLocaleTimeString('en-US', { hour: 'numeric', minute: '2-digit', timeZone: tz });
export function publicState({ t, engine }) {
const name = id => t.teamName(id);
const view = m => ({
@@ -17,7 +21,7 @@ export function publicState({ t, engine }) {
const teams = t.activeTeams().map(x => t.publicTeam(x.id));
const withdrawn = [...t.teams.values()].filter(x => x.status === 'withdrawn').map(x => t.publicTeam(x.id));
return {
slug: t.slug, name: t.name, date: t.date, notes: t.notes ?? '', phase: t.phase, banner: t.banner ?? null,
slug: t.slug, name: t.name, date: t.date, notes: t.notes ?? '', timezone: tzOf(t), phase: t.phase, banner: t.banner ?? null,
rules: t.rules, stages: t.stages, courtCount: t.courtCount,
teams, withdrawn, pools, bracket,
courts: board ? board.courts.map(c => ({ ...c, match: c.match ? view(t.match(c.match.id)) : null })) : [],