You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
i18n: allow to provide DateTimeFormat calendar #5440
bugAn error in the Docusaurus core causing instability or issues with its executiondifficulty: starterIssues that are starter difficulty level, e.g. minimal tweaking with a clear test plan.domain: i18nRelated to the i18n system
This code does not use the same calendar on Node.js (Gregorian) and browsers (Solar Hijri), leading to a different date being rendered in SSR and after React hydration.
We should provide an i18n locale option to force a given calendar and make sure the formatted date is consistent between SSR/client.
@slorber I've justed worked a bit on this. While it's useful to add another calendar config option, I wonder why would React hydration ever lead to a different result? Isn't the date always formatted on the server-side?
hmm yes it may not be a SSR problem in the end, can't be sure anymore 😅
It could also be related to different Node.js versions using different calendars for the same locale.
Maybe this is not an issue anymore since NodeJS has better Intl support, but it might still be useful to provide a calendar as an option 🤷♂️ we have seen some users don't like to use BCP47 codes for locale keys as it leads to complicated FS paths
bugAn error in the Docusaurus core causing instability or issues with its executiondifficulty: starterIssues that are starter difficulty level, e.g. minimal tweaking with a clear test plan.domain: i18nRelated to the i18n system
Activity
Josh-Cena commentedon Jan 21, 2022
@slorber I've justed worked a bit on this. While it's useful to add another
calendarconfig option, I wonder why would React hydration ever lead to a different result? Isn't the date always formatted on the server-side?slorber commentedon Jan 21, 2022
hmm yes it may not be a SSR problem in the end, can't be sure anymore 😅
It could also be related to different Node.js versions using different calendars for the same locale.
Maybe this is not an issue anymore since NodeJS has better Intl support, but it might still be useful to provide a calendar as an option 🤷♂️ we have seen some users don't like to use BCP47 codes for locale keys as it leads to complicated FS paths