feat: read timezone from url in Calender#12643
feat: read timezone from url in Calender#12643DrDrewCain wants to merge 10 commits intocalcom:mainfrom
Conversation
|
@hauchu1998 is attempting to deploy a commit to the cal Team on Vercel. A member of the Team first needs to authorize it. |
|
Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link to collect XP and win prizes! |
📦 Next.js Bundle Analysis for @calcom/webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 Eight Pages Changed SizeThe following pages changed size from the code in this PR compared to its base branch:
DetailsOnly the gzipped size is provided here based on an expert tip. First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If Any third party scripts you have added directly to your app using the The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored. |
|
Hey @DrDrewCain, I see you still making changes. Please let me know once this is ready for review again. |
Hey, just fixed and it should work, let me know if there are any issues. |
|
Hey @DrDrewCain It still isn't handled gracefully. See image ref: |
|
I think it would be good to wrap that check in a try/catch block, adjust the check boolean accordingly. That should settle this. |
There was a problem hiding this comment.
Also, please make use of useBookerStore as in line 43 for example, to accomodate states and query param.
const selectedDateString = useBookerStore((state) => state.selectedDate);
const setSelectedDate = useBookerStore((state) => state.setSelectedDate);
const addToSelectedDate = useBookerStore((state) => state.addToSelectedDate);
Gotcha, will make those changes ASAP. |
Hi, fixed. We use moment-timezone to do the timezone check. I should handle all the invalid param to default tz. Plz let us know if there're other issues. Thanks |
|
Hey @hauchu1998 we tend to refrain from adding new libraries unless absolutely necessary. In this case, it is unnecessary. We have checks for timezone validity in other parts of the codebase, I'd recommend taking inspiration from there. Using moment for this is a strict no-no, unfortunately. |
| "city-timezones": "^1.2.1", | ||
| "eslint": "^8.34.0", | ||
| "lucide-react": "^0.171.0", | ||
| "moment-timezone": "^0.5.43", |
There was a problem hiding this comment.
lets not add another timezone package. i think dayjs does this already
There was a problem hiding this comment.
Sure! We'll modify this; we will take a look at the hint Alishaz provided.
There was a problem hiding this comment.
lets not add another timezone package. i think dayjs does this already
We already have a helper utility function that handles this quite well 🙏 I've provided the reference and @DrDrewCain should be able to use that 🎉
|
Hey @DrDrewCain any updates here? |
|
This PR is being marked as stale due to inactivity. |
|
This PR is being closed due to inactivity. Please reopen if work is intended to be continued. |

What does this PR do?
We've allowed the option to pre-select timezone based on url param of a given timezone.
Fixes #12455
Fixed allow preferred timezone as url param for calendar.
Requirement/Documentation
Type of change
How should this be tested?
No environment are necessary; test by modifying the url using a url param; if you don't specify then we will automatically default it to the timezone already gained from local storage (cache).
Here's an image;
Mandatory Tasks
Checklist