From d9dc62924217cf334019aa04322a18e2e032d659 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 25 Jul 2023 20:27:08 +0200 Subject: [PATCH] fix: properly use date-fns difference functions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ChargingStationUtils.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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, -- 2.34.1