use-zod-default 1.0.20 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/v4.js +4 -12
- package/package.json +1 -1
package/dist/v4.js
CHANGED
|
@@ -35,18 +35,6 @@ const defaultInstance = (schema, source = {}) => {
|
|
|
35
35
|
if (schema instanceof z.ZodDate) {
|
|
36
36
|
return null;
|
|
37
37
|
}
|
|
38
|
-
if (schema instanceof z.ZodISODate) {
|
|
39
|
-
return new Date().toISOString().split('T')[0];
|
|
40
|
-
}
|
|
41
|
-
if (schema instanceof z.ZodISODateTime) {
|
|
42
|
-
return new Date().toISOString();
|
|
43
|
-
}
|
|
44
|
-
if (schema instanceof z.ZodISODuration) {
|
|
45
|
-
return 'P0D';
|
|
46
|
-
}
|
|
47
|
-
if (schema instanceof z.ZodISOTime) {
|
|
48
|
-
return new Date().toISOString().split('T')[1];
|
|
49
|
-
}
|
|
50
38
|
if (schema instanceof z.ZodDiscriminatedUnion) {
|
|
51
39
|
const firstOption = schema._zod.def.options[0];
|
|
52
40
|
return defaultInstance(cast(firstOption));
|
|
@@ -113,6 +101,10 @@ const defaultInstance = (schema, source = {}) => {
|
|
|
113
101
|
schema instanceof z.ZodGUID ||
|
|
114
102
|
schema instanceof z.ZodIPv4 ||
|
|
115
103
|
schema instanceof z.ZodIPv6 ||
|
|
104
|
+
schema instanceof z.ZodISODate ||
|
|
105
|
+
schema instanceof z.ZodISODateTime ||
|
|
106
|
+
schema instanceof z.ZodISODuration ||
|
|
107
|
+
schema instanceof z.ZodISOTime ||
|
|
116
108
|
schema instanceof z.ZodJWT ||
|
|
117
109
|
schema instanceof z.ZodKSUID ||
|
|
118
110
|
schema instanceof z.ZodNanoID ||
|
package/package.json
CHANGED