Files
vikunja/frontend/src/modelSchema/common/date.ts
Dominik Pschenitschni 6fddac75f9 feat: add zod schemas
(cherry picked from commit https://kolaente.dev/vikunja/frontend/pulls/2225)
2025-01-16 12:55:19 +01:00

11 lines
258 B
TypeScript

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())