Support for ISO dates ?
See original GitHub issueThanks for this amazing lib 🙏
I’d like to have support for ISO string dates:
const schema = z.string().date()
schema.parse("2021-06-02T16:23:50.048Z") // ✅ Ok
schema.parse("2021-06-02T16:23:50.048+02:00") // ✅ Ok
schema.parse("Not a date") // 🚫 Throws
Is it under preparation ?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:8 (2 by maintainers)
Top Results From Across the Web
ISO 8601 - Wikipedia
ISO 8601 is an international standard covering the worldwide exchange and communication of date and time-related data. It is maintained by the Geneva-based ......
Read more >ISO 8601 — Date and time format
ISO 8601 is the internationally accepted way to represent dates and times.
Read more >Use international date format (ISO) - Quality Web Tips - W3C
The ISO date format · YYYY is the year [all the digits, i.e. 2012] · MM is the month [01 (January) to 12...
Read more >What is the ISO date and time format? - TechTarget
For example, the ISO representation for July 15, 2022 is either 20220715 or 2022-07-15.
Read more >ISO 8601: The global standard for date and time formats
The ISO 8601 standard defines an internationally recognized format for representing dates and times. For times, they are expressed with the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I mean its a bit rough auto close
Not quite: that validates that the object is a
Date
object, not a valid ISO string date.I’m not aware of any plans on adding something like that, but there is a
refine
method that you can use if you already have a predicate function that returnsboolean
, like this one from npm.