Skip to content

fix: booking page opens on correct month for date-range limited event types#28480

Draft
Souissi4 wants to merge 5 commits intocalcom:mainfrom
Souissi4:fix/booking-range-period-opens-wrong-month
Draft

fix: booking page opens on correct month for date-range limited event types#28480
Souissi4 wants to merge 5 commits intocalcom:mainfrom
Souissi4:fix/booking-range-period-opens-wrong-month

Conversation

@Souissi4
Copy link

@Souissi4 Souissi4 commented Mar 18, 2026

What does this PR do?

When an event type has "Limit future bookings" set to "Within a date range"
with a future start date, the booking page was opening on the current month
showing no slots and displaying "Scheduling ended on [end date]. Please check
again soon." — even though the booking window had not opened yet. The message
was factually wrong and caused bookers to think the host was permanently
unavailable.

This fix detects when today is before periodStartDate and automatically
jumps the calendar to the first month of the booking window. It also disables
the prev/next navigation arrows outside the window boundaries.

Visual Demo (For contributors especially)

demo.mp4

Image Demo (if applicable):

Before — calendar opens on current month with wrong overlay message:
bug

After — calendar opens directly on the first available month:
fix

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A — this is a bug fix with no API or configuration changes.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

Setup:

  1. Create an event type
  2. Go to Limits tab
  3. Enable "Limit future bookings" → select "Within a date range"
  4. Set start date to any date at least 2 months from today
  5. Set end date to several months after that
  6. Open the public booking link in an incognito tab

Expected (after fix):

  • Calendar opens on the start month, not the current month
  • No "Scheduling ended" message is shown
  • The previous month arrow is disabled on the start month
  • The next month arrow is disabled on the end month
  • Navigation between months inside the window works normally

Automated tests:

yarn test-e2e --grep "booking-date-range"

4 tests, all passing.

Copilot AI review requested due to automatic review settings March 18, 2026 02:59
@github-actions github-actions bot added the 🐛 bug Something isn't working label Mar 18, 2026
@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Mar 18, 2026
@CLAassistant
Copy link

CLAassistant commented Mar 18, 2026

CLA assistant check
All committers have signed the CLA.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the booking DatePicker behavior for RANGE-based booking windows by (a) jumping to the start of the allowed window when it’s in the future, and (b) preventing month navigation beyond the configured start/end bounds. It also adds end-to-end coverage for the date range navigation behavior.

Changes:

  • Add min/max month navigation disabling in the shared calendars DatePicker component.
  • In the web booking flow, auto-jump the calendar to the RANGE start month when the window is in the future, and pass min/max dates down to the shared component.
  • Add a Playwright E2E test suite validating RANGE window month navigation behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/features/calendars/components/DatePicker.tsx Adds maxDate handling for next-month disabling and refines prev-month disabling with minDate.
apps/web/modules/bookings/components/DatePicker.tsx Adds effect to jump to RANGE start month and passes minDate/maxDate to shared DatePicker.
apps/web/playwright/booking/booking-date-range.e2e.ts New E2E coverage for RANGE booking window initial month + nav button enabled/disabled states.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files


Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

@Ryukemeister Ryukemeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @Souissi4, thank you for your contribution. however i'm not sure what would be the ideal behaviour to handle this, I was thinking what if instead of showing first available slot we update the popup dialog message to mention the user has limited slots and then add a button to jump to the first available slot. i'm not sure if this is the ideal or not, lemme talk to the team regarding this. until then i'll convert your PR into draft.

@Ryukemeister Ryukemeister marked this pull request as draft March 18, 2026 07:24
@Souissi4
Copy link
Author

hi @Ryukemeister, Thanks for the feedback!
Yeah, I think it's best to add a message like:
"Bookings for this event open on [date]. Click below to jump to the first available slot."
With a "Show available slots →" button. I thought about this direction while working on the fix but wasn't sure which approach was more ideal for the UX, so I went with the auto-jump for now.

@Ryukemeister
Copy link
Contributor

makes sense, all good. i've asked the team about it, will back to you when I have an answer. thank you!

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

Labels

🐛 bug Something isn't working community Created by Linear-GitHub Sync size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Booking page shows "Scheduling ended" message when booking window hasn't opened yet

4 participants