mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
The classic 1.2 sleep log and the activities list emit local wall-clock ISO strings without an offset. `parseLocalInstant` parsed them with a bare `new Date(iso)`, which reads an offset-less string in the process zone (UTC in production). A non-UTC user's sleep-segment `measuredAt` (the segment end) was therefore shifted by their UTC offset, and a near-midnight segment could flip onto the wrong wake-day in the night reconstruction. Resolve offset-less timestamps against the user's stored timezone via a new `zonedWallClockToUtc` helper (the inverse of `wallClockInTz`, DST-safe via the same two-pass converge as `startOfLocalDayInTz`). Thread the resolved zone through the sleep and workout sync paths. Strings that already carry an offset or `Z` stay absolute and parse as-is; an absent zone keeps the prior host-local fallback.