drizzle-team / drizzle-team/drizzle-orm
[BUG]: drizzle-zod incorrect mapping of date columns to zod string
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Report hasn't been filed before.
- [x] 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?
Contributor guide
Assessment
This issue has not been assessed yet.