import { z } from "zod"; export const jsonDate = z.codec( z.iso.datetime(), // input schema: ISO date string z.date(), // output schema: Date object { decode: (isoString) => new Date(isoString), // ISO string → Date encode: (date) => date.toISOString(), // Date → ISO string }, ); export type JsonDateObj = Date; export type JsonDateStr = string;