Detect users browser locale for time format 12/24 hours#1900
Merged
Conversation
|
This pull request is being automatically deployed with Vercel (learn more). docs – ./apps/docs🔍 Inspect: https://vercel.com/cal/docs/D7drTzAj4CWhtCqQQTRwwDfZjo46 [Deployment for d5fb4d3 canceled] calendso – ./apps/web🔍 Inspect: https://vercel.com/cal/calendso/BuibiHxra2J51ZKSvDu3j2RDmfRR |
added 7 commits
February 17, 2022 22:39
Member
|
what's missing @agustif ? |
Contributor
Author
Need to revert back removal of is24h switch and make it detect browser locale. Will finish it up today. =) |
…tions, renames timeFormat to detectBrowserTimeFormat to avoid collisions
…f, by calling it only if no localStorage settings are set
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.
What does this PR do?
This PR introduces a new util
timeFormat-> renamed to detectBrowserTimeFormat to detect the browser locale of the user and format the dates accordingly.I need to integrate it everywhere, started on BookingPage.
We respect the current implementation that lets the user switch the am/pm settings, but aut-detect it's browser locale to set it by default in the booking page and rest of the site (where is not configurable)
Fixes #1378
In places like payment page, sucess, meeting ended, etc I've left the new browserLocale instead of using useState (since it wasn't using the clock is24h util either on those pages)
Let me know what do you think and if I missed any time I need to fix please!
Type of change
How should this be tested?
Go to create a new booking, select a date and a time. Make sure the time is in the format of your browser locale. If you set 'en-US' as your default in chrome, you should see it with am/pm attached. 'es-ES' should show a 24h format without it.
You can test by reordering your top-language in chrome settings. Remember to delete the localStorage timeOptions.is24hClock setting so it takes the browser defaults instead
Video of testing the Switch and deletion of localStorage
https://www.loom.com/share/7ca400a8cf1e438b9841b3eac98c39b7
Checklist: