import { z } from "zod" export const jsonifyDateSchema = (schema: S) => schema.transform(v => v.toString()) export const dejsonifyDateSchema = (schema: S) => z .string() .transform(v => { try { return new Date(v) } catch (e) { return v } }) .pipe(schema)