We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a6e01d3 commit 5bc34d4Copy full SHA for 5bc34d4
packages/@react-stately/datepicker/src/utils.ts
@@ -25,7 +25,14 @@ function getLocale() {
25
// Match browser language setting here, NOT react-aria's I18nProvider, so that we match other browser-provided
26
// validation messages, which to not respect our provider's language.
27
// @ts-ignore
28
- return (typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage)) || 'en-US';
+ let locale = typeof navigator !== 'undefined' && (navigator.language || navigator.userLanguage) || 'en-US';
29
+
30
+ try {
31
+ Intl.DateTimeFormat.supportedLocalesOf([locale]);
32
+ } catch {
33
+ locale = 'en-US';
34
+ }
35
+ return locale;
36
}
37
38
export function getValidationResult(
0 commit comments