Closed matthew-kaye closed 5 months ago
Hello @matthew-kaye, thanks for opening an issue.
The behavior you describe makes sense to me. z.date() represents the JS Date class, which by default is serialized to JSON as a date-time string, thus matching z.string().datetime().
Feel free to reopen the issue if you don't agree!
Hello @matthew-kaye, thanks for opening an issue.
The behavior you describe makes sense to me. z.date() represents the JS Date class, which by default is serialized to JSON as a date-time string, thus matching z.string().datetime().
Feel free to reopen the issue if you don't agree!
I'm not sure I do agree actually sorry 😅 Since a zod schema for z.date()
would allow a data field like "2024-01-01" but a JSON schema requiring a date-time would not. It seems normal to me to expect that data which would pass the zod schema would also be accepted by the JSON schema generated from it
Steps to reproduce: