Skip to content

fix(booker): show correct message when booking range hasn't opened yet#28501

Closed
abdulbaqui17 wants to merge 3 commits intocalcom:mainfrom
abdulbaqui17:fix-28470-range-not-yet-open
Closed

fix(booker): show correct message when booking range hasn't opened yet#28501
abdulbaqui17 wants to merge 3 commits intocalcom:mainfrom
abdulbaqui17:fix-28470-range-not-yet-open

Conversation

@abdulbaqui17
Copy link

Summary

  • Detect when today is before a RANGE booking window's start date
  • Show "Bookings open on {{date}}" instead of the misleading "Scheduling ended on {{date}}"
  • Add no_availability_range_future i18n key
  • Add regression test covering the pre-open state

Root Cause

NoAvailabilityDialog rendered the no_availability_range translation ("Scheduling ended on…") for both states of a RANGE period: before the window opens and after it closes. The component had no branch for the "not yet open" case.

Fix

In useDescription (inside NoAvailabilityDialog.tsx), check whether dayjs() is before periodStartDate. If so, use the new no_availability_range_future key that references the start date; otherwise fall through to the existing end-date message.

Validation

TZ=UTC yarn vitest run packages/features/calendars/__tests__/NoAvailabilityDialog.test.tsx
# 6/6 tests pass

Fixes #28470

abdulbaqui17 and others added 3 commits March 19, 2026 07:38
When an event type uses a date-range booking window with a future start
date, the NoAvailabilityDialog was always showing "Scheduling ended on
<endDate>" — even before the range opened. Detect the pre-open state and
show "Bookings open on <startDate>" instead.

Adds no_availability_range_future i18n key and a regression test.

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 19, 2026
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

1 issue found across 8 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:47">
P2: RANGE pre-open check uses local-time day boundaries, which can flip the message incorrectly across timezones.</violation>
</file>

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

if (p.periodType === "RANGE") {
// If the current date is before the range start, the booking window hasn't opened yet.
// Show an informative "opens on" message rather than the misleading "scheduling ended" copy.
if (p.periodStartDate && dayjs().isBefore(dayjs(p.periodStartDate).startOf("day"))) {
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 19, 2026

Choose a reason for hiding this comment

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

P2: RANGE pre-open check uses local-time day boundaries, which can flip the message incorrectly across timezones.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/features/calendars/components/NoAvailabilityDialog.tsx, line 47:

<comment>RANGE pre-open check uses local-time day boundaries, which can flip the message incorrectly across timezones.</comment>

<file context>
@@ -42,6 +42,11 @@ const useDescription = (noFutureAvailability: boolean, p: PeriodData) => {
   if (p.periodType === "RANGE") {
+    // If the current date is before the range start, the booking window hasn't opened yet.
+    // Show an informative "opens on" message rather than the misleading "scheduling ended" copy.
+    if (p.periodStartDate && dayjs().isBefore(dayjs(p.periodStartDate).startOf("day"))) {
+      return t("no_availability_range_future", { date: dayjs(p.periodStartDate).format("MMMM D YYYY") });
+    }
</file context>
Suggested change
if (p.periodStartDate && dayjs().isBefore(dayjs(p.periodStartDate).startOf("day"))) {
if (p.periodStartDate && dayjs.utc().isBefore(dayjs.utc(p.periodStartDate).startOf("day"))) {
Fix with Cubic

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.

this is the same as #28495 gonna close this

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/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

3 participants