Context
Meal-plan server and client code currently derive civil dates with a mixture of local Date mutation and toISOString().slice(0, 10). A calendar day such as 2026-07-16 is not an instant, but converting local midnight to UTC can shift the represented date. Server and browser timezone differences can also produce different current weeks near midnight or daylight-saving transitions.
Meal planning must have deterministic date-only semantics across SSR, hydration, APIs, and users in different timezones.
Scope
- Define the source of the user's planning timezone and its fallback behavior.
- Treat meal-plan
YYYY-MM-DD values as civil/date-only values, separately from timestamps and instants.
- Establish one deterministic definition of week start and current day for server and client rendering.
- Remove UTC ISO conversion patterns that can change a civil date.
- Use Temporal/date-only helpers or an equivalent tested abstraction rather than ad hoc
Date arithmetic.
- Keep storage/API serialization independent from locale-specific display formatting.
- Define behavior when a user changes timezone or travels.
- Audit meal events, range queries, month/week generation, cart generation from meal events, and account nutrition summaries for the same issue.
- Add compatibility/migration guidance if existing persisted values or API contracts need reinterpretation.
- Add tests around midnight, DST boundaries, leap days, month/year transitions, and extreme offsets.
Acceptance criteria
Related
Out of scope
- Calendar-provider integrations.
- Automatic location tracking solely to infer timezone.
Context
Meal-plan server and client code currently derive civil dates with a mixture of local
Datemutation andtoISOString().slice(0, 10). A calendar day such as2026-07-16is not an instant, but converting local midnight to UTC can shift the represented date. Server and browser timezone differences can also produce different current weeks near midnight or daylight-saving transitions.Meal planning must have deterministic date-only semantics across SSR, hydration, APIs, and users in different timezones.
Scope
YYYY-MM-DDvalues as civil/date-only values, separately from timestamps and instants.Datearithmetic.Acceptance criteria
Related
Out of scope