Skip to content

[BUG]: drizzle-zod incorrect mapping of date columns to zod string #4570

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
valerii15298 opened this issue May 27, 2025 · 0 comments
Open
1 task done
Labels
bug Something isn't working

Comments

@valerii15298
Copy link
Contributor

valerii15298 commented May 27, 2025

Report hasn't been filed before.

  • I have verified that the bug I'm about to report hasn't been filed before.

Other packages

drizzle-zod@0.8.2

Describe the Bug

For column of type date({ mode: 'string' }) drizzle-zod uses z.string()
But zod 4 has z.iso.date type which represents specifically string iso date: https://zod.dev/api?id=iso-dates which validates format YYYY-MM-DD which is format the column with date({ mode: 'string' }) type will return.

Currently there is a test in drizzle-zod for this case which ensures date({ mode: 'string' }) will become z.string()
https://github.com/drizzle-team/drizzle-orm/blob/main/drizzle-zod/tests/pg.test.ts#L416
https://github.com/drizzle-team/drizzle-orm/blob/main/drizzle-zod/tests/pg.test.ts#L464

Introducing of this will be a breaking change.
Do you think we can implement such behavior?

Would you be open for a PR for this change?

@valerii15298 valerii15298 added the bug Something isn't working label May 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant