Files
babymonitor/plan.md
T

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

  1. Frontend API Fix: Modified fetchWakeSleepTimes in frontend/src/api/client.ts to convert the local wakeup_ref and bedtime_ref HH:MM strings into UTC HH:MM strings before sending them to the backend.
  2. Frontend Component Fix: Updated WakeupPlot.tsx and BedtimePlot.tsx to use the returned wakeup_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.