return true;
}
const validate = this.ajv.compile(schema);
- this.convertDateToISOString<T>(payload);
+ OCPPServiceUtils.convertDateToISOString<T>(payload);
if (validate(payload)) {
return true;
}
}
}
- private convertDateToISOString<T extends JsonType>(obj: T): void {
- for (const k in obj) {
- if (obj[k] instanceof Date) {
- (obj as JsonObject)[k] = (obj[k] as Date).toISOString();
- } else if (obj[k] !== null && typeof obj[k] === 'object') {
- this.convertDateToISOString<T>(obj[k] as T);
- }
- }
- }
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public abstract requestHandler<ReqType extends JsonType, ResType extends JsonType>(
chargingStation: ChargingStation,
import type { DefinedError, ErrorObject } from 'ajv';
import BaseError from '../../exception/BaseError';
+import type { JsonObject, JsonType } from '../../types/JsonType';
import type { SampledValueTemplate } from '../../types/MeasurandPerPhaseSampledValueTemplates';
import { StandardParametersKey } from '../../types/ocpp/Configuration';
import { ErrorType } from '../../types/ocpp/ErrorType';
return true;
}
+ public static convertDateToISOString<T extends JsonType>(obj: T): void {
+ for (const k in obj) {
+ if (obj[k] instanceof Date) {
+ (obj as JsonObject)[k] = (obj[k] as Date).toISOString();
+ } else if (obj[k] !== null && typeof obj[k] === 'object') {
+ this.convertDateToISOString<T>(obj[k] as T);
+ }
+ }
+ }
+
protected static getSampledValueTemplate(
chargingStation: ChargingStation,
connectorId: number,