Comments (2)
Yes, I'd recommend using a string field. If you want to verify that the string is, say, a valid ISO date string, then use a custom validator in combination with something like validator.js to enforce that. 👍
I wasn't initially planning to support Date schemas at all since they're not easily serializable but they were requested by multiple people. I think dealing with dates as ISO strings (until you actually need to display them in a human-readable format) is far more intuitive.
from zod.
Thanks Awesome
from zod.
Related Issues (20)
- literal uses `\"` in error message
- Usage of .nonstrict() which is deprecated instead of .passthrough() in some tests
- infer literal in discriminatedUnion fails typecheck but not parse
- Add a .precision(number) option to numbers which checks the number of digits after the decimal point
- zod safeparse not working with nextjs server action useFormState hok HOT 1
- Descriptions from root schema carry over to schemas created with a chained `.array()`
- How make field optional but have minimal character HOT 2
- Is it possible to create a zod enum from a string literal type HOT 1
- Importing `infer` type makes all props `unknown`? HOT 1
- Zod Preprocess returning unknown type HOT 1
- object.props "required" but z.infer<T> returns "optional" type? HOT 2
- Required key inferred as optional in mutually recursive tree structure HOT 1
- Strip checks and effects
- Zod refine is not working HOT 1
- Type Inference not working HOT 1
- add `actual` for `invalid_string` error in `.regex()` HOT 2
- Add a Real Example of File Upload Validation to Documentation HOT 1
- Recursive types losing types and get `any`
- Feature Request: Autoscroll to Input Field on Validation Error HOT 1
- Documentation example for recursive types gives type error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from zod.