fix(booker): show correct message when booking range hasn't opened yet#28501
Closed
abdulbaqui17 wants to merge 3 commits intocalcom:mainfrom
Closed
fix(booker): show correct message when booking range hasn't opened yet#28501abdulbaqui17 wants to merge 3 commits intocalcom:mainfrom
abdulbaqui17 wants to merge 3 commits intocalcom:mainfrom
Conversation
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>
|
|
Contributor
There was a problem hiding this comment.
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"))) { |
Contributor
There was a problem hiding this comment.
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"))) { |
Contributor
Ryukemeister
left a comment
There was a problem hiding this comment.
this is the same as #28495 gonna close this
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.
Summary
no_availability_range_futurei18n keyRoot Cause
NoAvailabilityDialogrendered theno_availability_rangetranslation ("Scheduling ended on…") for both states of aRANGEperiod: before the window opens and after it closes. The component had no branch for the "not yet open" case.Fix
In
useDescription(insideNoAvailabilityDialog.tsx), check whetherdayjs()is beforeperiodStartDate. If so, use the newno_availability_range_futurekey that references the start date; otherwise fall through to the existing end-date message.Validation
Fixes #28470