zod icon indicating copy to clipboard operation
zod copied to clipboard

v4 `z.iso.datetime({ local: true })` does not accept valid `datetime-local` input values from HTML

Open joesanchezjr opened this issue 7 months ago • 0 comments

The z.iso.datetime({ local: true }) validator does not accept values returned from an HTML <input type="datetime-local">, even though these are valid ISO 8601 local date-time strings without seconds.

Expected Behavior: The value "2025-05-21T12:00" is valid per the ISO 8601 standard (without seconds) and is commonly returned by datetime-local inputs. It should be accepted by z.iso.datetime({ local: true }).

Related issue and PR for v3: https://github.com/colinhacks/zod/issues/3636 https://github.com/colinhacks/zod/pull/4315

Minimum reproducible example: https://github.com/joesanchezjr/zod-datetime/

joesanchezjr avatar May 21 '25 21:05 joesanchezjr