export function formatDate(iso: string): string { try { return new Intl.DateTimeFormat("en-CA", { timeZone: "UTC", year: "numeric", month: "2-digit", day: "2-digit", }).format(new Date(iso)); } catch { return iso; } } export function formatDateTime(iso: string): string { try { const parts = new Intl.DateTimeFormat("en-CA", { timeZone: "UTC", year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", hour12: false, }).formatToParts(new Date(iso)); const get = (type: string) => parts.find((p) => p.type === type)?.value ?? ""; return `${get("year")}-${get("month")}-${get("day")} ${get("hour")}:${get("minute")}:${get("second")} UTC`; } catch { return iso; } }