import type { JSONSchemaType } from 'ajv';
import { Client, type FTPResponse } from 'basic-ftp';
-import { addSeconds, differenceInSeconds, isDate, maxTime, secondsToMilliseconds } from 'date-fns';
+import {
+ type Interval,
+ addSeconds,
+ differenceInSeconds,
+ isDate,
+ maxTime,
+ secondsToMilliseconds,
+} from 'date-fns';
import { create } from 'tar';
import { OCPP16Constants } from './OCPP16Constants';
if (typeof date === 'number') {
return !isNaN(date);
} else if (isDate(date)) {
- return !isNaN((date as Date).getTime());
+ return !isNaN(date.getTime());
}
return false;
};
return value as undefined;
}
if (isDate(value)) {
- return value as Date;
+ return value;
}
if (isString(value) || typeof value === 'number') {
- const valueToDate = new Date(value as string | number);
+ const valueToDate = new Date(value!);
if (isNaN(valueToDate.getTime())) {
- throw new Error(`Cannot convert to date: '${value as string | number}'`);
+ throw new Error(`Cannot convert to date: '${value!}'`);
}
return valueToDate;
}