[P1] Fix timezone issue with birthday on dashboard (#82) #96

Closed
opened 2026-07-07 16:21:56 +12:00 by fastie81 · 0 comments
Owner

Problem

Issue #82 "Time zone issue with birthday on dashboard" - birthdays show wrong day due to UTC vs local timezone.

Root Cause

  • date_of_birth stored as DATE (no timezone) in PostgreSQL
  • Frontend receives ISO date string (e.g., "1990-07-15")
  • JavaScript new Date("1990-07-15") parses as UTC midnight
  • Users in UTC+12 (NZ) see previous day (July 14)

Expected Behavior

Birthdays should display correctly in user's local timezone.

Fix Options

  1. Backend: Return date with timezone context
  2. Frontend: Parse as local date: new Date(dateString + 'T00:00000:00') or use dateString.split('-') to construct local Date
  3. Store: Add timezone field to user profile
// In dashboard component
const parseBirthday = (dateString) => {
  const [year, month, day] = dateString.split('-').map(Number);
  return new Date(year, month - 1, day); // Local date, no timezone shift
};
  • app/core/entities/models.py (Member model date_of_birth field)
  • frontend/src/pages/dashboard/ (birthday display)
  • frontend/src/contexts/AuthContext.tsx (user profile with timezone?)
### Problem Issue #82 "Time zone issue with birthday on dashboard" - birthdays show wrong day due to UTC vs local timezone. ### Root Cause - `date_of_birth` stored as DATE (no timezone) in PostgreSQL - Frontend receives ISO date string (e.g., "1990-07-15") - JavaScript `new Date("1990-07-15")` parses as UTC midnight - Users in UTC+12 (NZ) see previous day (July 14) ### Expected Behavior Birthdays should display correctly in user's local timezone. ### Fix Options 1. **Backend**: Return date with timezone context 2. **Frontend**: Parse as local date: `new Date(dateString + 'T00:00000:00')` or use `dateString.split('-')` to construct local Date 3. **Store**: Add `timezone` field to user profile ### Recommended Fix (Frontend) ```typescript // In dashboard component const parseBirthday = (dateString) => { const [year, month, day] = dateString.split('-').map(Number); return new Date(year, month - 1, day); // Local date, no timezone shift }; ``` ### Related Files - `app/core/entities/models.py` (Member model date_of_birth field) - `frontend/src/pages/dashboard/` (birthday display) - `frontend/src/contexts/AuthContext.tsx` (user profile with timezone?)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
fastie81/honbu-manager#96
No description provided.