[OPE-165] Fix holiday dates shifting timezone#103
Merged
Conversation
ScheduleUnavailability.StartDate/EndDate now use DateOnly (same as holidays) so the evaluator never misinterprets a stored date as a UTC midnight timestamp. buildUnavailableSet and collectBoundaries now accept a *time.Location derived from schedule.Timezone. Unavailability boundaries are computed as midnight-in-schedule-tz rather than UTC midnight, so a leave marked for DATE 2026-05-28 in Asia/Kolkata is excluded exactly on IST May 28 instead of bleeding into May 29. Also changes onSaved for the unavailability modal to call invalidateAll() (which also bumps the Gantt timeline key) instead of refetch() alone, so the Gantt chart updates immediately without a manual page refresh.
Segment ends are exclusive (end = start of next segment). Using >= was harmless before because UTC-aligned boundaries never exactly coincided with local midnight. Now that collectBoundaries uses schedule-timezone midnight, the boundary is exactly at the local day start and the >= comparison incorrectly matched the next day.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
models.DateOnly(namedstringtype) — stores and marshals holiday dates as"YYYY-MM-DD"with no timezone component, eliminating accidental RFC3339 timestamp serializationScheduleHoliday.Datefromtime.TimetoDateOnly; DB column was alreadyDATE— no migration neededScheduleDetailPageto use local timezone date strings (localDateStr) instead oftoISOString().slice(0,10)for:from/toparams (UTC caused UTC+ users to miss last-day-of-month holidays)todayStrRoot cause
toISOString()always returns the UTC date. For UTC+5:30 users, the window end computed astoISOString().slice(0,10)was one calendar day earlier than the visible month end, causing the last day's holidays to not load. ThetodayStrmismatch caused the today's holiday banner to be off by ±1 day depending on timezone offset.Test plan
go test ./...— all passnpm run build— zero errors