/** UTC ISO-8601 time helpers. See PLAN.md ยง3.3. */ /** Current time as a UTC ISO-8601 string with Z suffix. */ export function nowIso(): string { return new Date().toISOString(); } /** Parse an ISO timestamp to a Date, throwing on invalid input. */ export function parseIso(value: string): Date { const d = new Date(value); if (Number.isNaN(d.getTime())) { throw new Error(`Invalid ISO timestamp: ${value}`); } return d; } /** Format a Date as a UTC ISO-8601 string. */ export function toIso(d: Date): string { return d.toISOString(); } /** Compact HH:MM label (UTC) for the autosave indicator. */ export function clockLabel(d: Date = new Date()): string { return d.toISOString().slice(11, 16); }