Skip to content

fix: show correct message when RANGE booking window hasn't opened yet#28664

Open
claygeo wants to merge 2 commits intocalcom:mainfrom
claygeo:fix/range-booking-not-started-message
Open

fix: show correct message when RANGE booking window hasn't opened yet#28664
claygeo wants to merge 2 commits intocalcom:mainfrom
claygeo:fix/range-booking-not-started-message

Conversation

@claygeo
Copy link
Copy Markdown

@claygeo claygeo commented Mar 29, 2026

What does this PR fix?

Fixes #28470

When an event type has a fixed date range (periodType: RANGE), the "No Availability" dialog always showed:

"Scheduling ended on [endDate]. Please check again soon."

...even when the current date was before periodStartDate (the booking window hadn't opened yet).

Root cause

isTimeViolatingFutureLimit correctly returns true for both:

  • dates before startOfRangeStartDayInEventTz (isBeforeRangeStart)
  • dates after endOfRangeEndDayInEventTz (isAfterRangeEnd)

This makes noFutureAvailability = true in both cases. But useDescription in NoAvailabilityDialog.tsx used a single message for the whole RANGE case, so users saw "Scheduling ended" even when the window hadn't started.

Fix

In useDescription, check whether today is before periodStartDate. If so, use the new no_availability_range_not_started message instead:

Before start date:

"Scheduling opens on [startDate]. Please check again soon."

After end date (unchanged):

"Scheduling ended on [endDate]. Please check again soon."

Changes

  • packages/features/calendars/components/NoAvailabilityDialog.tsx — add pre-start branch in useDescription
  • packages/i18n/locales/en/common.json — add no_availability_range_not_started key

Test plan

  • Create an event type with periodType: RANGE, periodStartDate in the future
  • Open the booking page and browse to the current month (before the start)
  • Verify the dialog shows "Scheduling opens on [startDate]" not "Scheduling ended"
  • Create an event type with periodType: RANGE, periodEndDate in the past
  • Verify the dialog still shows "Scheduling ended on [endDate]"

🤖 Generated with Claude Code

When an event has a fixed date range (periodType: RANGE), the
NoAvailabilityDialog always showed "Scheduling ended on [endDate]"
regardless of whether the user was before the start date or after
the end date. Both cases triggered noFutureAvailability=true because
isTimeViolatingFutureLimit returns true for isBeforeRangeStart OR
isAfterRangeEnd.

Now distinguishes the two states:
- Before periodStartDate → "Scheduling opens on [startDate]. Please check again soon."
- After periodEndDate → "Scheduling ended on [endDate]. Please check again soon." (unchanged)

Adds i18n key: no_availability_range_not_started

Fixes calcom#28470

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added the 🐛 bug Something isn't working label Mar 29, 2026
Copy link
Copy Markdown
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.

1 issue found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/features/calendars/components/NoAvailabilityDialog.tsx">

<violation number="1" location="packages/features/calendars/components/NoAvailabilityDialog.tsx:45">
P2: RANGE message classification uses local-time comparison instead of the same normalized timezone basis as period-limit evaluation, which can show the wrong copy near timezone boundaries.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Copy link
Copy Markdown
Member

@romitg2 romitg2 left a comment

Choose a reason for hiding this comment

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

please address cubic comments

…valuation

The before/after range start comparison used local-time dayjs() which
could show the wrong dialog copy near timezone boundaries. Switch to
dayjs.utc() so the message classification uses the same normalized
timezone basis as calculatePeriodLimits (which parses range dates with
dayjs.utc and evaluates with eventUtcOffset=0 in the dialog context).

if (p.periodType === "RANGE") {
return t("no_availability_range", { date: dayjs(p.periodEndDate).format("MMMM D YYYY") });
if (p.periodStartDate && dayjs.utc().isBefore(dayjs.utc(p.periodStartDate))) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

random thought but would it make sense to have some kind of button that will displayed right next to our message having a title something like : Jump to ${periodStartDate}. we don't have to do it in this PR itself i'm just laying out an idea here.
@claygeo @romitg2 thoughts on this?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Nice idea — a "Jump to date" shortcut would be a solid UX improvement, especially for RANGE windows that open far in the future. Agreed it's a separate PR though. Happy to pick it up as a follow-up if there's interest.

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

Labels

🐛 bug Something isn't working size/XS

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

3 participants