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:
Gabriel Jablonski
2025-11-26 04:54:29 -03:00
committed by GitHub
parent 94a9e4e067
commit 7e0507e3b5

View File

@@ -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(
() =>