);
if (interval > 0) {
this.reservationExpirationSetInterval = setInterval((): void => {
- const now = new Date();
+ const dateNow = new Date();
if (this.hasEvses) {
for (const evseStatus of this.evses.values()) {
for (const connectorStatus of evseStatus.connectors.values()) {
- if (connectorStatus.reservation && connectorStatus.reservation.expiryDate < now) {
+ if (connectorStatus.reservation && connectorStatus.reservation.expiryDate < dateNow) {
this.removeReservation(
connectorStatus.reservation,
ReservationTerminationReason.EXPIRED,
}
} else {
for (const connectorStatus of this.connectors.values()) {
- if (connectorStatus.reservation && connectorStatus.reservation.expiryDate < now) {
+ if (connectorStatus.reservation && connectorStatus.reservation.expiryDate < dateNow) {
this.removeReservation(
connectorStatus.reservation,
ReservationTerminationReason.EXPIRED,
Constants,
DCElectricUtils,
cloneObject,
+ convertToDate,
convertToInt,
isEmptyObject,
isEmptyString,
logger.warn(
`${logPrefix} ${moduleName}.getLimitFromChargingProfiles: startSchedule is not a Date object in charging profile id ${chargingProfile.chargingProfileId}. Trying to convert it to a Date object`,
);
- chargingSchedule.startSchedule = new Date(chargingSchedule.startSchedule!);
+ chargingSchedule.startSchedule = convertToDate(chargingSchedule.startSchedule)!;
}
chargingSchedule.startSchedule.setFullYear(
currentDate.getFullYear(),