From: Jérôme Benoit Date: Sun, 14 Jan 2024 12:42:46 +0000 (+0100) Subject: refactor: cleanup arguments namespace X-Git-Tag: v1.2.32~8 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=1e2ec4a6612809e178b5237bf6302562ba3c0512;p=e-mobility-charging-stations-simulator.git refactor: cleanup arguments namespace Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ocpp/OCPPServiceUtils.ts b/src/charging-station/ocpp/OCPPServiceUtils.ts index 53548065..3e375b82 100644 --- a/src/charging-station/ocpp/OCPPServiceUtils.ts +++ b/src/charging-station/ocpp/OCPPServiceUtils.ts @@ -1329,16 +1329,16 @@ export class OCPPServiceUtils { return true } - public static convertDateToISOString(obj: T): void { - for (const key in obj) { + public static convertDateToISOString(object: T): void { + for (const key in object) { // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-non-null-assertion - if (isDate(obj![key])) { + if (isDate(object![key])) { // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-non-null-assertion - (obj![key] as string) = (obj![key] as Date).toISOString() + (object![key] as string) = (object![key] as Date).toISOString() // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-unnecessary-condition - } else if (typeof obj![key] === 'object' && obj![key] !== null) { + } else if (typeof object![key] === 'object' && object![key] !== null) { // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion, @typescript-eslint/no-non-null-assertion - OCPPServiceUtils.convertDateToISOString(obj![key] as T) + OCPPServiceUtils.convertDateToISOString(object![key] as T) } } } diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index 458fd930..ae27035f 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -240,7 +240,7 @@ const deepClone = ( return clone as O } if (value instanceof Date) { - return new Date(value.valueOf()) as O + return new Date(value.getTime()) as O } if (typeof value !== 'object' || value === null) { return value as unknown as O