991 B
991 B
Plan: Fix Wakeup Plot Timezone Display
Status: COMPLETED
Problem
WakeupPlot.tsx shows incorrect wakeup times (e.g., showing 01:00 instead of 05:00 when input is 03:00 UTC in Stockholm). This was caused by sending a local reference time to the backend, which then calculated a delta relative to that time being treated as UTC.
Solution
- Frontend API Fix: Modified
fetchWakeSleepTimesinfrontend/src/api/client.tsto convert the localwakeup_refandbedtime_refHH:MM strings into UTC HH:MM strings before sending them to the backend. - Frontend Component Fix: Updated
WakeupPlot.tsxandBedtimePlot.tsxto use the returnedwakeup_minutes/bedtime_minutes(which is now a correctly calculated timezone-invariant delta) directly as the offset from reference, instead of attempting to re-adjust it using local timezone offsets.
Verification
Verified with Playwright test in Europe/Stockholm timezone: 03:00 UTC input correctly displays as 05:00.