This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
|
import { preprocess, date } from 'zod'
|
|
|
|
export const DateSchema = preprocess((arg) => {
|
|
if (
|
|
// FIXME: Add comment why we check for `0001`
|
|
typeof arg == 'string' && !arg.startsWith('0001') ||
|
|
arg instanceof Date
|
|
) {
|
|
return new Date(arg)
|
|
}
|
|
}, date()) |