/** * The user's LOCAL calendar date as 'YYYY-MM-DD'. * * Never derive "today" from `toISOString().split('T')[0]` — that is the UTC * date, which disagrees with the wall clock between local midnight and the UTC * rollover (for a UTC+2 user, from 00:00 to 02:00 every night). Trip and * journey dates are wall-clock dates, so every "is this today/past/upcoming" * comparison must use this instead. * * (Converting a Date you deliberately built in UTC — `new Date(s + 'T00:00:00Z')` * round-tripped through date arithmetic — is a different, self-consistent * pattern and fine as it is.) */ export function localIsoDate(d: Date = new Date()): string { return `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, '0')}-${String(d.getDate()).padStart(2, '0')}` }