diff --git a/site/source/pages/statistiques/_components/AccessibleTable.tsx b/site/source/pages/statistiques/_components/AccessibleTable.tsx index 28a23ad15..d831947ad 100644 --- a/site/source/pages/statistiques/_components/AccessibleTable.tsx +++ b/site/source/pages/statistiques/_components/AccessibleTable.tsx @@ -27,7 +27,10 @@ export const AccessibleTable = ({ formatValue, caption, }: AccessibleTableProps) => { - const { t } = useTranslation() + const { + t, + i18n: { language }, + } = useTranslation() return ( @@ -54,8 +57,8 @@ export const AccessibleTable = ({ {period === 'mois' - ? formatMonth(visite.date) - : formatDay(visite.date)} + ? formatMonth(visite.date, language) + : formatDay(visite.date, language)} {visite.nombre} @@ -74,8 +77,8 @@ export const AccessibleTable = ({ {visite.date && ( {period === 'mois' - ? formatMonth(visite.date) - : formatDay(visite.date)} + ? formatMonth(visite.date, language) + : formatDay(visite.date, language)} )} diff --git a/site/source/pages/statistiques/_components/LastMonthIndicators.tsx b/site/source/pages/statistiques/_components/LastMonthIndicators.tsx index 0e2f10f2c..3953506e2 100644 --- a/site/source/pages/statistiques/_components/LastMonthIndicators.tsx +++ b/site/source/pages/statistiques/_components/LastMonthIndicators.tsx @@ -42,7 +42,7 @@ export function MainIndicators({ return ( <> -

Notre impact en {formatMonth(lastMonth.date)}

+

Notre impact en {formatMonth(lastMonth.date, language)}

}> @@ -86,7 +86,7 @@ export function MainIndicators({ {satisfactionLastMonth?.nbAvisMoyenne} avis reçus {satisfactionLastMonth?.nbMoisMoyenne === 1 - ? ` en ${formatMonth(lastMonth.date)}` + ? ` en ${formatMonth(lastMonth.date, language)}` : ` sur les ${satisfactionLastMonth?.nbMoisMoyenne} derniers mois`} diff --git a/site/source/pages/statistiques/_components/utils.tsx b/site/source/pages/statistiques/_components/utils.tsx index f65fa60b7..3bf8c7566 100644 --- a/site/source/pages/statistiques/_components/utils.tsx +++ b/site/source/pages/statistiques/_components/utils.tsx @@ -1,12 +1,12 @@ -export function formatDay(date: string | Date) { - return new Date(date).toLocaleString('default', { +export function formatDay(date: string | Date, language: string) { + return new Date(date).toLocaleString(language, { weekday: 'long', day: 'numeric', month: 'long', }) } -export function formatMonth(date: string | Date) { - return new Date(date).toLocaleString('default', { +export function formatMonth(date: string | Date, language: string) { + return new Date(date).toLocaleString(language, { month: 'long', year: 'numeric', })