cal.com icon indicating copy to clipboard operation
cal.com copied to clipboard

fix: #15833 [CAL-4055] Same first slot in different timezones

Open vijayraghav-io opened this issue 1 year ago • 15 comments

What does this PR do?

  • Fixes #15833
  • Fixes CAL-4055(Linear issue number - should be visible at the bottom of the GitHub issue description)

After Changes - https://www.loom.com/share/d3e067e558184cd2aa7e62ca2e48c770?sid=76ab6332-5e38-4421-8247-e76991fa4751

Root cause - The minDate, used to set the start date in getAvailableDatesInMonth was using browserDate, updated this to calculate today's date in selected timezone. https://github.com/calcom/cal.com/blob/a74522af3d667cd78daee7990d58d5610312fb8c/packages/features/calendars/lib/getAvailableDatesInMonth.ts#L10

Mandatory Tasks (DO NOT REMOVE)

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

vijayraghav-io avatar Jul 19 '24 20:07 vijayraghav-io

@vijayraghav-io is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Jul 19 '24 20:07 vercel[bot]

Graphite Automations

"Add community label" took an action on this PR • (07/19/24)

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

"Add consumer team as reviewer" took an action on this PR • (07/19/24)

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

graphite-app[bot] avatar Jul 19 '24 20:07 graphite-app[bot]

Can we add a unit test for this?

Yes i am adding

vijayraghav-io avatar Jul 20 '24 09:07 vijayraghav-io

@vijayraghav-io great works. Left some comment. Let me know what you think?

Thankyou! replied inline

vijayraghav-io avatar Jul 20 '24 09:07 vijayraghav-io

Scenario of first day in month:

https://www.loom.com/share/f917aa77fc4f442aadb7d31b94be7435?sid=0a61481c-d67b-4154-b68f-66ee6a19c490

vijayraghav-io avatar Jul 20 '24 17:07 vijayraghav-io

@emrysal , can you please share your comments/reviews

vijayraghav-io avatar Jul 30 '24 03:07 vijayraghav-io

reminding to please review or approve if reviewed

vijayraghav-io avatar Aug 09 '24 06:08 vijayraghav-io

This PR is being marked as stale due to inactivity.

github-actions[bot] avatar Aug 24 '24 00:08 github-actions[bot]

Gentle reminder! for review. Please let know if any questions.

vijayraghav-io avatar Aug 24 '24 06:08 vijayraghav-io

This PR is being marked as stale due to inactivity.

github-actions[bot] avatar Sep 08 '24 00:09 github-actions[bot]

Gentle reminder! for review. Please let know if any questions.

vijayraghav-io avatar Sep 08 '24 07:09 vijayraghav-io

This PR is being marked as stale due to inactivity.

github-actions[bot] avatar Sep 23 '24 00:09 github-actions[bot]

Gentle reminder! for review. Please let know if any questions.

vijayraghav-io avatar Sep 24 '24 06:09 vijayraghav-io

Could we also fix this dot that is shown on the current day? Everything else looks good to me 🙏

Thankyou! 🙏 , Sure have fixed the dot to show as per selected timezone's 'today' and verified.

vijayraghav-io avatar Oct 03 '24 07:10 vijayraghav-io

This PR is being marked as stale due to inactivity.

github-actions[bot] avatar Oct 18 '24 00:10 github-actions[bot]

Gentle Reminder!

vijayraghav-io avatar Oct 21 '24 10:10 vijayraghav-io

E2E results are ready!

github-actions[bot] avatar Oct 24 '24 16:10 github-actions[bot]

@anikdhabal , have addressed your latest comments.

vijayraghav-io avatar Nov 01 '24 14:11 vijayraghav-io

Hi @vijayraghav-io I've created a spun off PR that fixes this issue in a different manner by addressing the issue in the code responsible for generating the date string array in the first place. I've left a self-review with a detailed overview of the changes I've made. I've used the tests you've created for this PR.

https://github.com/calcom/cal.com/pull/19389

Any thoughts greatly appreciated!

emrysal avatar Feb 19 '25 17:02 emrysal

Hi @vijayraghav-io I've created a spun off PR that fixes this issue in a different manner by addressing the issue in the code responsible for generating the date string array in the first place. I've left a self-review with a detailed overview of the changes I've made. I've used the tests you've created for this PR.

#19389

Any thoughts greatly appreciated!

Hi @emrysal , When i started with this bug fix, i din't dare to change anything inside the function getAvailableDatesInMonth(), because recently it had fix related to timezone bugs (daylight adjustments). So, I felt changing the data type from Date to Dayjs inside this function may be riskier. As new Date() and dayjs.toDate() behaves differently when we have timezones, because of which we have the bug.

Hence took the approach (playing it safe) of changing the type of input parameter minDate passed to this function instead. As, i had called out in my self review as well - https://github.com/calcom/cal.com/pull/15840/files#r1821905247 and in description.

Nonetheless, you would have considered all scenarios.

My PR also had the fix for this comment https://github.com/calcom/cal.com/pull/15840#pullrequestreview-2344109636 of showing the dot as per the new start date as per timezone https://github.com/calcom/cal.com/pull/15840#issuecomment-2390729279 Hope you would have considered this or can take as a reminder.

vijayraghav-io avatar Feb 20 '25 06:02 vijayraghav-io

hey @vijayraghav-io is this PR still on?

retrogtx avatar Mar 07 '25 11:03 retrogtx

hey @vijayraghav-io is this PR still on?

yes, will resolve merge conflicts

vijayraghav-io avatar Mar 07 '25 11:03 vijayraghav-io

hey @vijayraghav-io u still working on this ?

Devanshusharma2005 avatar Jun 27 '25 10:06 Devanshusharma2005

hey @vijayraghav-io u still working on this ?

yes it was RFR, will resolve latest merge conflicts

vijayraghav-io avatar Jun 27 '25 11:06 vijayraghav-io

@Devanshusharma2005 , resolved merge conflicts and all tests are passing.

vijayraghav-io avatar Jun 28 '25 09:06 vijayraghav-io

@Devanshusharma2005 , reminding for merge 🙏

vijayraghav-io avatar Jul 01 '25 05:07 vijayraghav-io

@vijayraghav-io thanks for your work. But we internally talked about this and @emrysal is planning to tackle it here: - https://github.com/calcom/cal.com/pull/19389 in a diff way.

anikdhabal avatar Jul 14 '25 09:07 anikdhabal

@vijayraghav-io thanks for your work. But we internally talked about this and @emrysal is planning to tackle it here: - #19389 in a diff way.

@anikdhabal , please refer this https://github.com/calcom/cal.com/pull/19389#issuecomment-2671271703

vijayraghav-io avatar Jul 14 '25 11:07 vijayraghav-io