Skip to content

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

@valerii15298

Description

@valerii15298

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions