export class DateReviver {
    nativeTypeName() {
        return "Date";
    }
    isInstance(value) {
        return value instanceof Date;
    }
    serialize(value) {
        const time = value.getTime();
        return {
            __nativeType: this.nativeTypeName(),
            iso: Number.isNaN(time) ? null : value.toISOString(),
        };
    }
    validate(value) {
        return typeof value.iso === "string" || value.iso === null;
    }
    revive(value) {
        return value.iso === null ? new Date(NaN) : new Date(value.iso);
    }
}
