Repository navigation
feat: Handle daylight-saving changes in slot generation - #828
Merged
Qoder-Voidd merged 1 commit intoOct 20, 2026
Merged
Qoder-Voidd merged 1 commit into
Qoder-Voidd merged 1 commit into
Conversation
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.
Fix: map local workspace hours to correct instants across DST transitions
Summary
Slot generation currently treats workspace hours as if the UTC offset never changes. On days when the offset changes (DST start or end), slots can land an hour off, or be generated for local times that don’t exist or exist twice. This PR makes slot generation work from an explicit IANA timezone and resolves each local time to an instant using the offset in effect on that specific date.
Problem
Workspace hours are defined in local time (for example, 09:00–17:00). To book against them, those hours have to be converted into absolute instants. Using a fixed offset, or the server’s timezone, breaks on two kinds of days:
America/New_Yorkon the March transition, don’t exist. Naive conversion either shifts them silently or produces invalid slots.Without an explicit timezone, the result also depends on the server environment, so the same request can behave differently across deployments.
Changes
backend/src/bookings/dto/create-booking.dto.tstimezonefield (IANA identifier, e.g.Africa/Lagos,America/New_York).[confirm: validator used, e.g. a custom check via Intl.DateTimeFormat or class-validator's IsTimeZone]backend/src/bookings/providers/timezone-slot-generator.provider.ts[confirm: skip vs. shift behaviour][confirm: first occurrence, or both occurrences as distinct instants]backend/src/bookings/providers/timezone-slot-generator.provider.spec.tsTest coverage
Test dates are fixed (for example, the 2026 US transitions on 8 March and 1 November) so the tests don’t depend on when they run.
Acceptance criteria
Breaking change / rollout notes
timezone. Requests without it will fail validation. Frontend callers and any integrations need updating before or alongside this deploy.[confirm: callers affected][confirm: stored values are already UTC instants]How to test
npm test -- timezone-slot-generator.provider.spec(frombackend/)America/New_Yorkon 2026-03-08 and 2026-11-01, and confirm there is no slot in the skipped hour and no duplicates in the repeated hour.timezoneand with an invalid one, and confirm both return 400.Reviewer notes
Closes #604
Closes #605
Closes #600
Closes #606