Tuesday, June 2, 2026

Fix Birth Date Shifting on Save/Load

Volleyball Elite Academy development update
Volleyball Elite Academy
Fix Birth Date Shifting on Save/Load

Fix Birth Date Shifting on Save/Load

Volleyball Elite Academy — Development Update • June 2, 2026

Fix Birth Date Shifting on Save/Load

What & Why

The Birth Date field on the My Profile page () saves and displays dates 1–2 days earlier than what the user entered. For example, entering January 18, 1960 comes back as January 16th or 17th after saving.

The cause is a classic UTC-vs-local timezone bug. When the page loads a saved date string like from the API, it converts it with . JavaScript parses a bare date string like this as UTC midnight, not local midnight. When the calendar then renders this Date object in the user's local timezone (CST = UTC−6), it displays as January 17th — one day earlier. If the user re-saves that displayed value and reloads, another shift can compound the error, producing the two-day drift the user observed.

The same UTC-parsing pattern also appears in the callback prop on the Calendar (), which could silently block valid late-December 1919 dates.

The project's established rule is: all dates must be parsed as local time (America/Regina, UTC−6), never as UTC.

Done looks like

  • A user opens My Profile, picks January 18 1960, saves, and the field still shows January 18 1960 after reload — no drift.
  • Repeated save/reload cycles do not shift the date further.
  • The fix is consistent with the project-wide "parse dates as local time" rule documented in .

Out of scope

  • Changing the date picker UI component or the Popover/Calendar layout.
  • Fixing birthdate handling in any other page (e.g. , registration flows — those already use a plain string input and are not affected).

Steps

1. Add a local-date parse helper in — a small function that splits a string and constructs (local midnight, no UTC interpretation). This mirrors the project timezone rule.

2. Replace the UTC-parsing call on load — on line 90, replace with the new local-date helper so the initial form value reflects the correct local calendar day.

3. Fix the Calendar boundary — on line 322, replace with a local-date construction () so the lower-bound check is also timezone-safe.

4. Verify the save path is unaffected — confirm that on line 103 already serialises using local time (it does via date-fns), so no change is needed on the write path.

Relevant files

-

Volleyball Elite Academy

Reply to this email — we read every reply.

You received this because you have an account with Volleyball Elite Academy.

elitevolleyball.training

No comments:

Post a Comment