From dd069c85bb24c4e09d35ed63fce506ed777b65b1 Mon Sep 17 00:00:00 2001 From: Abdullah Hassan Date: Tue, 18 Apr 2023 19:19:37 +0500 Subject: [PATCH] fix date string zod validation --- packages/schema/src/plugins/zod/transformer.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/schema/src/plugins/zod/transformer.ts b/packages/schema/src/plugins/zod/transformer.ts index 8b73fe825..6a6ce1169 100644 --- a/packages/schema/src/plugins/zod/transformer.ts +++ b/packages/schema/src/plugins/zod/transformer.ts @@ -114,7 +114,7 @@ export default class Transformer { } else if (inputType.type === 'Boolean') { result.push(this.wrapWithZodValidators('z.boolean()', field, inputType)); } else if (inputType.type === 'DateTime') { - result.push(this.wrapWithZodValidators('z.date()', field, inputType)); + result.push(this.wrapWithZodValidators('z.union([z.date(), z.string().datetime()])', field, inputType)); } else if (inputType.type === 'Json') { this.hasJson = true;