From fba431bfe7d5ef237c049aa68de684ce061b5686 Mon Sep 17 00:00:00 2001 From: Thomas Heartman Date: Mon, 1 Sep 2025 11:17:55 +0200 Subject: [PATCH] Update time formats for other charts on analytics page --- .../insights/components/LineChart/createChartOptions.ts | 8 +++++++- .../CreationArchiveChart/CreationArchiveChart.tsx | 2 +- .../CreationArchiveChart => }/getDateFnsLocale.ts | 0 3 files changed, 8 insertions(+), 2 deletions(-) rename frontend/src/component/insights/{componentsChart/CreationArchiveChart => }/getDateFnsLocale.ts (100%) diff --git a/frontend/src/component/insights/components/LineChart/createChartOptions.ts b/frontend/src/component/insights/components/LineChart/createChartOptions.ts index 82a515ff67..7b9abc0022 100644 --- a/frontend/src/component/insights/components/LineChart/createChartOptions.ts +++ b/frontend/src/component/insights/components/LineChart/createChartOptions.ts @@ -4,6 +4,7 @@ import type { TooltipState } from './ChartTooltip/ChartTooltip.jsx'; import { createTooltip } from './createTooltip.js'; import { legendOptions } from './legendOptions.js'; import type { ChartOptions } from 'chart.js'; +import { getDateFnsLocale } from 'component/insights/getDateFnsLocale.js'; export const createOptions = ( theme: Theme, @@ -59,10 +60,15 @@ export const createOptions = ( }, }, x: { + adapters: { + date: { + locale: getDateFnsLocale(locationSettings.locale), + }, + }, type: 'time', time: { unit: 'week', - tooltipFormat: 'PPP', + tooltipFormat: 'P', }, grid: { color: 'transparent', diff --git a/frontend/src/component/insights/componentsChart/CreationArchiveChart/CreationArchiveChart.tsx b/frontend/src/component/insights/componentsChart/CreationArchiveChart/CreationArchiveChart.tsx index 6a240d9030..0be2d7b4b6 100644 --- a/frontend/src/component/insights/componentsChart/CreationArchiveChart/CreationArchiveChart.tsx +++ b/frontend/src/component/insights/componentsChart/CreationArchiveChart/CreationArchiveChart.tsx @@ -23,7 +23,7 @@ import type { WeekData, RawWeekData } from './types.ts'; import { createTooltip } from 'component/insights/components/LineChart/createTooltip.ts'; import { CreationArchiveRatioTooltip } from './CreationArchiveRatioTooltip.tsx'; import { Chart } from 'react-chartjs-2'; -import { getDateFnsLocale } from './getDateFnsLocale.ts'; +import { getDateFnsLocale } from '../../getDateFnsLocale.ts'; ChartJS.register( CategoryScale, diff --git a/frontend/src/component/insights/componentsChart/CreationArchiveChart/getDateFnsLocale.ts b/frontend/src/component/insights/getDateFnsLocale.ts similarity index 100% rename from frontend/src/component/insights/componentsChart/CreationArchiveChart/getDateFnsLocale.ts rename to frontend/src/component/insights/getDateFnsLocale.ts