fix(dates): show a stated calendar date as that date east of UTC+12

Day keys anchored at noon UTC went through the zone-aware
dateShortSmart, which shows them as the next day in UTC+12..+14. A
dateShortSmartCalendar formatter reads the key in UTC with the same
year rule, and the predictions panel, the illness timeline, the
intraday pulse day label, the nutrient chart and the coach result
chart use it. The lab chart dates a date-only reading by its calendar
date and a timed one in the reader's zone, as the lab lists do. The
timezone formatter guard now fails on a noon anchor handed to a
zone-aware formatter.
This commit is contained in:
Marc-André Bombeck committed 2026-10-03 18:44:06 +02:00
1 parent 358ef23239
commit 9ecdda6358
9 files changed
+171 -17

No files matched your search

+4 -4
View File
@@ -32,12 +32,12 @@ import type { CyclePrediction, CycleHistoryResponse } from "./types";
* locale, never the app's) with no year. Predictions run 1-2 cycles out, so
* a window straddling New Year's would otherwise print an unadorned "Jan 3"
* in December. Routes through the app-locale conditional-year formatter
* instead; `dateShortSmart` already renders day+month in the locale's field
* order and only adds the year when it differs from the current one.
* instead; it renders day+month in the locale's field order and only adds
* the year when it differs from the current one. The calendar variant reads
* the key in UTC, so the date never rolls a day in UTC+12..+14.
*/
function formatDate(d: string, fmt: Formatters): string {
// Render at noon UTC so the YYYY-MM-DD never rolls a day across tz.
return fmt.dateShortSmart(`${d}T12:00:00Z`);
return fmt.dateShortSmartCalendar(d);
}
function confidenceTone(c: number): {