// Reminder datetime helpers. Reminders are stored as ISO UTC; the editor's // works in local time. export function toLocalInput(iso: string | null): string { if (!iso) return ""; const d = new Date(iso); const pad = (n: number) => String(n).padStart(2, "0"); return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}T${pad(d.getHours())}:${pad(d.getMinutes())}`; } export function fromLocalInput(local: string): string | null { if (!local) return null; return new Date(local).toISOString(); } export function formatReminder(iso: string | null): string { if (!iso) return ""; return new Date(iso).toLocaleString(undefined, { month: "short", day: "numeric", hour: "numeric", minute: "2-digit", }); } export function isOverdue(iso: string | null): boolean { return !!iso && new Date(iso).getTime() < Date.now(); }