From bc5c25deb0528cf32b0b2ca1df413038355f8710 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Fri, 25 Jun 2021 19:33:18 +0200 Subject: [PATCH] Fixed issue due to immutability --- src/visits/helpers/LineChartCard.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/visits/helpers/LineChartCard.tsx b/src/visits/helpers/LineChartCard.tsx index 25589c43..abc5ffc2 100644 --- a/src/visits/helpers/LineChartCard.tsx +++ b/src/visits/helpers/LineChartCard.tsx @@ -49,11 +49,11 @@ const STEPS_MAP: Record = { hourly: 'Hour', }; -const STEP_TO_DURATION_MAP: Record = { - hourly: { hours: 1 }, - daily: { days: 1 }, - weekly: { weeks: 1 }, - monthly: { months: 1 }, +const STEP_TO_DURATION_MAP: Record Duration> = { + hourly: (hours: number) => ({ hours }), + daily: (days: number) => ({ days }), + weekly: (weeks: number) => ({ weeks }), + monthly: (months: number) => ({ months }), }; const STEP_TO_DIFF_FUNC_MAP: Record number> = { @@ -115,7 +115,7 @@ const generateLabels = (step: Step, visits: NormalizedVisit[]): string[] => { return [ formatter(oldestDate), - ...rangeOf(size, () => formatter(add(oldestDate, duration))), + ...rangeOf(size, (num) => formatter(add(oldestDate, duration(num)))), ]; };