From: Jérôme Benoit Date: Tue, 25 Jul 2023 18:27:08 +0000 (+0200) Subject: fix: properly use date-fns difference functions X-Git-Tag: v1.2.20~144 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=d9dc62924217cf334019aa04322a18e2e032d659;p=e-mobility-charging-stations-simulator.git fix: properly use date-fns difference functions Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStationUtils.ts b/src/charging-station/ChargingStationUtils.ts index 709d1dd1..cd586a1c 100644 --- a/src/charging-station/ChargingStationUtils.ts +++ b/src/charging-station/ChargingStationUtils.ts @@ -782,11 +782,11 @@ const getLimitFromChargingProfiles = ( (index < chargingSchedule.chargingSchedulePeriod.length - 1 && chargingSchedule.duration! > differenceInSeconds( - chargingSchedule.startSchedule!, addSeconds( chargingSchedule.startSchedule!, chargingSchedule.chargingSchedulePeriod[index + 1].startPeriod, ), + chargingSchedule.startSchedule!, )) ) { const result: ChargingProfilesLimit = { @@ -829,7 +829,7 @@ const prepareRecurringChargingProfile = ( ) { chargingSchedule.startSchedule = addDays( chargingSchedule.startSchedule!, - differenceInDays(chargingSchedule.startSchedule!, recurringInterval.end), + differenceInDays(recurringInterval.end, chargingSchedule.startSchedule!), ); recurringInterval = { start: chargingSchedule.startSchedule, @@ -849,7 +849,7 @@ const prepareRecurringChargingProfile = ( ) { chargingSchedule.startSchedule = addWeeks( chargingSchedule.startSchedule!, - differenceInWeeks(chargingSchedule.startSchedule!, recurringInterval.end), + differenceInWeeks(recurringInterval.end, chargingSchedule.startSchedule!), ); recurringInterval = { start: chargingSchedule.startSchedule,