const fmt = new Intl.DateTimeFormat("en", { month: "short", day: "numeric", year: "numeric", timeZone: "UTC" }); export const date = (iso: string | null) => (iso ? fmt.format(new Date(`${iso}T00:00:00Z`)) : ""); export const plural = (n: number, word: string) => `${n} ${word}${n === 1 ? "" : "s"}`; // Spread the 17 disciplines around the colour wheel (golden-angle steps). const hues = new Map(); export function hue(discipline: string, order: string[]): number { let h = hues.get(discipline); if (h === undefined) { const i = Math.max(0, order.indexOf(discipline)); h = Math.round((i * 137.508 + 225) % 360); hues.set(discipline, h); } return h; }