Minimal reproduction for Zod 4 date issue with Sveltekit Superforms

This repo demonstrates a problem when using a Zod 4 schema with a date field in combination with Sveltekit Superforms and dateProxy.

Issue: When submitting the form, the Zod 4 schema validation fails with:

Invalid input: expected date, received string

Comparison:

  • The Zod 3 version works as expected: the string input is accepted and converted to a Date.
  • The Zod 4 version fails validation, even though the input is valid for a date field.

How to reproduce:

  1. Run the app (npm install && npm run dev).
  2. Open the form and submit a date in both Zod 3 and Zod 4 sections.
  3. Observe that Zod 3 accepts the input, but Zod 4 returns the error above.

Expected: Submitting a valid date string should be accepted and converted to a Date object for Zod 4, just like Zod 3.


The Zod 3 form is included below the Zod 4 form for comparison.

Top categories

svelte logo

Need a Svelte website built?

Hire a professional Svelte developer today.
Loading Svelte Themes