From 7e0507e3b533966a84c6926e080f8bd66afbd647 Mon Sep 17 00:00:00 2001 From: Gabriel Jablonski Date: Wed, 26 Nov 2025 04:54:29 -0300 Subject: [PATCH] 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 --- .../components/heatmaps/HeatmapDateRangeSelector.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/javascript/dashboard/routes/dashboard/settings/reports/components/heatmaps/HeatmapDateRangeSelector.vue b/app/javascript/dashboard/routes/dashboard/settings/reports/components/heatmaps/HeatmapDateRangeSelector.vue index a2b05a959..9e9021e93 100644 --- a/app/javascript/dashboard/routes/dashboard/settings/reports/components/heatmaps/HeatmapDateRangeSelector.vue +++ b/app/javascript/dashboard/routes/dashboard/settings/reports/components/heatmaps/HeatmapDateRangeSelector.vue @@ -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( () =>