/** An exact moment in the viewer's own zone, with its date. */ export function when(iso: string): string { return new Date(iso).toLocaleString(undefined, { dateStyle: 'medium', timeStyle: 'short' }); } /** * The server keeps the run hour in UTC; this is that hour on the viewer's * clock today. Today's offset is used, so across daylight saving the local * label moves while the run stays at the same UTC hour. */ export function hourLabel(utcHour: number, now: Date = new Date()): string { const d = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), utcHour)); return d.toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit' }); }