Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Valid timeslot marked 'slot no longer available' #19590

Merged

Conversation

hariombalhara
Copy link
Member

@hariombalhara hariombalhara commented Feb 27, 2025

What does this PR do?

  • Handle the timeslots that can cross day boundaries when interpreted in timezone other than GMT. Such timeslots were being considered unavailable.
  • Also introduced isFeatureEnabledForVisitor that allows rollout of a feature to people coming to book/submit routing forms or anything else on public pages
    • Using ROLLOut for quick availability check feature now with default set to 0 i.e. disabled.
    • E2E test the feature even if rollout pc is 0

To enable the 'Slot no longer available' feature we need to now set env variable. X is a percentage b/w 0 and 100.
0 to disable and 100 to enable for everyone.
NEXT_PUBLIC_QUICK_AVAILABILITY_ROLLOUT=X

After fix: https://www.loom.com/share/faefa4eb70564d939c49a5d8d495fbf5
Before fix: https://www.loom.com/share/096de9efb184410d8d60ed37aa44ed9f?from_recorder=1&focus_title=1

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • N/A I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

  • Create all day availability
  • Use it in an event-type and try to book the earliest possible timeslots or the last possible timeslots.

Copy link
Contributor

github-actions bot commented Feb 27, 2025

Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the Conventional Commits specification and it looks like your proposed title needs to be adjusted.

Details:

No release type found in pull request title "Handle date mismatch b/w schedule key and slot". Add a prefix to indicate what kind of release this pull request corresponds to. For reference, see https://www.conventionalcommits.org/

Available types:
 - feat: A new feature
 - fix: A bug fix
 - docs: Documentation only changes
 - style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
 - refactor: A code change that neither fixes a bug nor adds a feature
 - perf: A code change that improves performance
 - test: Adding missing tests or correcting existing tests
 - build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
 - ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
 - chore: Other changes that don't modify src or test files
 - revert: Reverts a previous commit

Copy link

vercel bot commented Feb 27, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
cal ⬜️ Ignored (Inspect) Visit Preview Feb 27, 2025 6:29am
calcom-web-canary ⬜️ Ignored (Inspect) Visit Preview Feb 27, 2025 6:29am

@keithwillcode keithwillcode added core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO labels Feb 27, 2025
@hariombalhara hariombalhara force-pushed the hotfix-is-timeslot-available-schedule-key-and-value-date-mismatch branch from f03b440 to c38f7b0 Compare February 27, 2025 01:52
@hariombalhara hariombalhara changed the title Handle date mismatch b/w schedule key and slot fix: Handle date mismatch b/w schedule key and slot Feb 27, 2025
@hariombalhara hariombalhara changed the title fix: Handle date mismatch b/w schedule key and slot fix: Valid timeslot marked 'slot no longer available' Feb 27, 2025
@hariombalhara hariombalhara marked this pull request as ready for review February 27, 2025 01:56
@graphite-app graphite-app bot requested a review from a team February 27, 2025 01:56
@dosubot dosubot bot added bookings area: bookings, availability, timezones, double booking 🐛 bug Something isn't working labels Feb 27, 2025
Comment on lines +46 to +47
const dateBefore = dayjs(dateInGMT).subtract(1, "day").format("YYYY-MM-DD");
const dateAfter = dayjs(dateInGMT).add(1, "day").format("YYYY-MM-DD");
Copy link
Member Author

@hariombalhara hariombalhara Feb 27, 2025

Choose a reason for hiding this comment

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

Using this approach of checking on previous and next date as well of a particular date to find the timeslot.

Avoiding the approach of using the booker timezone to obtain the date to lookup for as that could still be buggy if user changes timezone on client and the timezone and the currently available scheduleData is out of sync(because getSchedule request could be in progress)

Copy link

graphite-app bot commented Feb 27, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (02/27/25)

1 reviewer was added to this PR based on Keith Williams's automation.

"Add foundation team as reviewer" took an action on this PR • (02/27/25)

1 reviewer was added to this PR based on Keith Williams's automation.

Copy link
Contributor

github-actions bot commented Feb 27, 2025

E2E results are ready!

@@ -76,6 +76,10 @@ export const PUBLIC_QUERY_AVAILABLE_SLOTS_INTERVAL_SECONDS =
export const PUBLIC_INVALIDATE_AVAILABLE_SLOTS_ON_BOOKING_FORM =
process.env.NEXT_PUBLIC_INVALIDATE_AVAILABLE_SLOTS_ON_BOOKING_FORM === "1";

// Enables a feature for x% of all visitors. Takes a number between 0 and 100.
export const PUBLIC_QUICK_AVAILABILITY_ROLLOUT =
parseInt(process.env.NEXT_PUBLIC_QUICK_AVAILABILITY_ROLLOUT ?? "", 10) || 0;
Copy link
Member Author

Choose a reason for hiding this comment

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

Keeping default value to 0 so that it goes live disabled and we can enable it at convenient time

@hariombalhara hariombalhara force-pushed the hotfix-is-timeslot-available-schedule-key-and-value-date-mismatch branch from 28f1653 to 9864f64 Compare February 27, 2025 06:25
@github-actions github-actions bot added the ❗️ .env changes contains changes to env variables label Feb 27, 2025
@@ -31,19 +91,14 @@ export const isTimeSlotAvailable = ({
return true;
}

const dateInIso = isValidISOFormat(slotToCheckInIso) ? slotToCheckInIso.split("T")[0] : null;
const dateInGMT = isValidISOFormat(slotToCheckInIso) ? slotToCheckInIso.split("T")[0] : null;
Copy link
Member Author

Choose a reason for hiding this comment

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

Not calling it ISO because ISO has time as well and it is just date.

@zomars zomars merged commit 0ad5770 into main Feb 27, 2025
41 checks passed
@zomars zomars deleted the hotfix-is-timeslot-available-schedule-key-and-value-date-mismatch branch February 27, 2025 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bookings area: bookings, availability, timezones, double booking 🐛 bug Something isn't working core area: core, team members only enterprise area: enterprise, audit log, organisation, SAML, SSO ❗️ .env changes contains changes to env variables ready-for-e2e
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants