Fix error in reduceSumStatisticsByDay (#10170)

This commit is contained in:
Bram Kragten 2021-10-07 15:26:41 +02:00 committed by GitHub
parent 910cd98a38
commit 85956dc7fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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(),