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
Update date format to user local format #7249
Comments
It's a bit complicated and constantly brought up, but even after #6430, we don't have a good way to fix this issue (or is it an issue?) yet. We've added a little explanation in our docs. Basically, because the site's locale is Maybe we should update the date formatting once we are in browser in |
I tried to search for an existent issue, didn't find those... But yeah, I don't want to decide per locale, I'd want the user's locale to "win". I've never really used React's hydration, so I don't have anything to contribute as to how feasible it is 😀 But defaulting to US is sorta weird (albeit understandable) - they're the only ones who use it 😅 Could do ISO (i.e. |
We don't specifically format the date by some format; we format it by |
I edited in a suggestion of ISO after original post, might be a good middle ground? |
I'm not sure what scope you want that ISO format to apply: (a) to all locales, or (b) just to For (a), I'd say using the locale date format is usually not that ambiguous. e.g.
Both seem like good ways out, but the second way could potentially solve other edge-cases if there are other diverging date formats in other locales that I'm not aware of. |
Wow, i18n is complicated... We should stop assuming language === region and update region-specific tags by user locale everywhere... |
The doc page is static. I'm not sure we want to add "overrides". If Open to fix the displayed local after React hydration, which means the user would see US date MM-dd-yyyy when static page loads, and then the format is swapped for the dd-MM-yyyy one. Note that this can produce a weird UX if the date is above the fold and the user can see the format change after page load. Another option remains: build the site in both |
Will keep this open until we provide more flexibility for users to define how they want to handle blog/doc date formats See also #7673 (comment) |
Have you read the Contributing Guidelines on issues?
Prerequisites
npm run clear
oryarn clear
command.rm -rf node_modules yarn.lock package-lock.json
and re-installing packages.Description
Doc pages have e.g.
Last updated on 4/25/2022 by Simen Bekkhus
, which is the US locale. This makes the date ambiguous when the date is 1-12. While that would still be the case if the date uses the local locale, at least I'd read it correctly 😅Reproducible demo
https://github.com/facebook/jest
Steps to reproduce
Look at the bottom of e.g. https://jestjs.io/docs/jest-object#fake-timers
Expected behavior
For non-US locales, that it says
Last updated on 25/04/2022 by Simen Bekkhus
, likenew Intl.DateTimeFormat().format()
returns when I run it in the Chrome console. I.e. uses local locale, not US locale.Actual behavior
It uses US date formatting.
Your environment
2.0.0-beta.18
Self-service
The text was updated successfully, but these errors were encountered: