From 85956dc7fd1e2072321486ea2abf94c308de03b2 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 7 Oct 2021 15:26:41 +0200 Subject: [PATCH] Fix error in `reduceSumStatisticsByDay` (#10170) --- src/data/history.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/data/history.ts b/src/data/history.ts index 243e457960..a163ea4708 100644 --- a/src/data/history.ts +++ b/src/data/history.ts @@ -490,7 +490,7 @@ export const reduceSumStatisticsByDay = ( // add init value if the first value isn't end of previous period result.push({ ...values[0]!, - start: startOfMonth(addDays(new Date(values[0].start), -1)).toISOString(), + start: startOfDay(addDays(new Date(values[0].start), -1)).toISOString(), }); } let lastValue: StatisticValue; @@ -546,7 +546,7 @@ export const reduceSumStatisticsByMonth = ( prevMonth = month; } if (prevMonth !== month) { - // Last value of the day + // Last value of the month result.push({ ...lastValue!, start: startOfMonth(new Date(lastValue!.start)).toISOString(),