fix: invalid language tag in heatmap component in reports page (#12952)
## Description This PR fixes a `RangeError: Invalid language tag` that occurs in the Heatmap report when using locales with underscores (e.g., `pt_BR`, `zh_TW`). The issue was caused by passing the raw locale string from `vue-i18n` (which uses underscores for some regions) directly to `Intl.DateTimeFormat`. The `Intl` API expects BCP 47 language tags which use hyphens (e.g., `pt-BR`). This change sanitizes the locale string by replacing underscores with hyphens before creating the `DateTimeFormat` instance. Fixes #12951
This commit is contained in:
committed by
GitHub
parent
94a9e4e067
commit
7e0507e3b5
@@ -52,11 +52,12 @@ const dayMenuItemConfigs = computed(() => [
|
||||
},
|
||||
]);
|
||||
|
||||
const resolvedLocale = computed(
|
||||
() =>
|
||||
const resolvedLocale = computed(() => {
|
||||
const currentLocale =
|
||||
locale.value ||
|
||||
(typeof navigator !== 'undefined' ? navigator.language : 'en')
|
||||
);
|
||||
(typeof navigator !== 'undefined' ? navigator.language : 'en');
|
||||
return currentLocale.replace('_', '-');
|
||||
});
|
||||
|
||||
const monthFormatter = computed(
|
||||
() =>
|
||||
|
||||
Reference in New Issue
Block a user