fix: fix recurring charging profile translation to current time interval
authorJérôme Benoit <jerome.benoit@sap.com>
Tue, 25 Jul 2023 18:39:47 +0000 (20:39 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Tue, 25 Jul 2023 18:39:47 +0000 (20:39 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/ChargingStationUtils.ts

index cd586a1cf8329721f72a82d5faef4804583a5a38..ca4ec0b200130e00b6a80ee8dbbdc15df4358d1f 100644 (file)
@@ -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,