Skip to content

Accept booking slots that fall on the next UTC date of the schedule window - #1904

Open
jayhemnani9910 wants to merge 1 commit into
thunderbird:mainfrom
jayhemnani9910:fix/booking-slot-utc-date
Open

jayhemnani9910 wants to merge 1 commit into
thunderbird:mainfrom
jayhemnani9910:fix/booking-slot-utc-date

Conversation

@jayhemnani9910

Copy link
Copy Markdown

What changed?

is_this_a_valid_booking_time now checks the slot against the schedule windows starting the day before, on, and the day after the slot's UTC date, in both the default and the custom-availability branch. Added test_slot_on_next_utc_date and test_window_saved_before_dst_starts in test/unit/test_utils.py.

Implementation assisted by Claude Code. I reproduced the bug, reviewed the change and checked the tests.

Why?

The schedule's times are stored in UTC, and the check built the window from the slot's UTC date. When a local working day crosses midnight UTC (9:00–17:00 in Sydney is 22:00–06:00 UTC), slots on the second UTC date were compared with the following day's window and rejected as too early, although the booking page offers them. In Sydney 11:00–16:00 couldn't be booked; in Los Angeles the 16:00 slot. A DST change since the schedule was saved can shift the window by another day (16:00–20:00 saved in January in Los Angeles: the 16:00 PDT slot in July).

Limitations and Notes

The window is checked for three days because the stored UTC times alone (plus the offset at save time) don't say which UTC date the local day starts on.

Applicable Issues

Closes #1903

QA Log

  • test_slot_on_next_utc_date: Sydney 00:00Z and 05:00Z slots accepted, 06:00Z and 21:00Z rejected; Los Angeles 00:00Z accepted, 01:00Z rejected. The accepted cases fail without the change.
  • Generated the slots Tools.available_slots_from_schedule offers for every day of 2027 across 14 timezones, 7 local windows (saved in January and July) and custom availabilities, and validated each: main rejects 119,654 of 505,764 offered slots, this change none; scanning every UTC quarter hour, no slot validates that isn't offered.
  • Backend pytest: 491 passed; TestDnsCaldavLookup::test_for_txt_record (DNS) and test_disable_enable_subscriber fail the same way on main here. ruff check and ruff format --check clean.

@sonarqubecloud

Copy link
Copy Markdown

@greptile-apps

greptile-apps Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

Fixes booking checks for working hours that cross midnight UTC or shift across UTC dates after daylight saving changes.

  • Booking checks match slots to schedule windows across nearby UTC dates.

No actionable issues found. Tests were not run during this review.

Reviews (1) · Last reviewed commit: "Accept booking slots that fall on the ne..." · Reviewed by Greptile

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Booking page offers slots that can't be booked ("slot could not be found") when the slot's UTC date is the next day

1 participant