From: Jérôme Benoit Date: Tue, 25 Jul 2023 18:39:47 +0000 (+0200) Subject: fix: fix recurring charging profile translation to current time interval X-Git-Tag: v1.2.20~143 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=05b52716e8aecade28e957d243969639086fd1e4;p=e-mobility-charging-stations-simulator.git fix: fix recurring charging profile translation to current time interval Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStationUtils.ts b/src/charging-station/ChargingStationUtils.ts index cd586a1c..ca4ec0b2 100644 --- a/src/charging-station/ChargingStationUtils.ts +++ b/src/charging-station/ChargingStationUtils.ts @@ -829,7 +829,7 @@ const prepareRecurringChargingProfile = ( ) { chargingSchedule.startSchedule = addDays( chargingSchedule.startSchedule!, - differenceInDays(recurringInterval.end, chargingSchedule.startSchedule!), + differenceInDays(currentDate, recurringInterval.start), ); recurringInterval = { start: chargingSchedule.startSchedule, @@ -849,7 +849,7 @@ const prepareRecurringChargingProfile = ( ) { chargingSchedule.startSchedule = addWeeks( chargingSchedule.startSchedule!, - differenceInWeeks(recurringInterval.end, chargingSchedule.startSchedule!), + differenceInWeeks(currentDate, recurringInterval.start), ); recurringInterval = { start: chargingSchedule.startSchedule,