mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
Four chart components (HealthChart, MoodChart, MedicationComplianceChart, ComplianceLineChart) now accept a userTimezone prop, default "Europe/Berlin" for backwards compat. Inside each chart, the X-axis tick formatter, tooltip date label, and per-day bucketing all run through a tz-aware makeFormatters(locale, userTz) instance instead of the legacy formatDateShort() which pinned to Europe/Berlin. Mount sites that already pull useAuth() pass user?.timezone: dashboard /page.tsx, trends-row, recommendation-card, insight-advisor-card. Ad-hoc usages without a user (storybook-style or test harnesses) keep the default Europe/Berlin rendering bit-for-bit. The HealthChart's daily-aggregation key (toDayKey) was also rewritten to depend on the userTimezone prop so a 23:50 Pacific/Auckland reading buckets to the Auckland day instead of the Berlin day for chart data display. The TanStack Query cache key gains userTimezone so a tz change inside a session re-fetches and re-buckets correctly. Tests: 109 chart-component tests stay green.