@mac777/project-pinecone-schema 1.0.13 → 1.0.14
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.
|
@@ -137,14 +137,17 @@ exports.approvedEventEditSchema = zod_1.z.object({
|
|
|
137
137
|
schedule: zod_1.z.object({
|
|
138
138
|
startDate: zod_1.z.date(),
|
|
139
139
|
endDate: zod_1.z.date()
|
|
140
|
-
}).optional().
|
|
141
|
-
if (!data
|
|
142
|
-
return
|
|
143
|
-
const diff = Math.abs(data
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
140
|
+
}).optional().superRefine((data, ctx) => {
|
|
141
|
+
if (!data)
|
|
142
|
+
return;
|
|
143
|
+
const diff = Math.abs(data.startDate.getTime() - data.endDate.getTime());
|
|
144
|
+
if (diff > 2 * 60 * 60 * 1000) {
|
|
145
|
+
ctx.addIssue({
|
|
146
|
+
path: ['endDate'],
|
|
147
|
+
message: 'Schedule must be within 2 hours of original',
|
|
148
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
148
151
|
})
|
|
149
152
|
});
|
|
150
153
|
// Published
|
package/package.json
CHANGED
|
@@ -152,13 +152,20 @@ export const approvedEventEditSchema = z.object({
|
|
|
152
152
|
schedule: z.object({
|
|
153
153
|
startDate: z.date(),
|
|
154
154
|
endDate: z.date()
|
|
155
|
-
}).optional().
|
|
156
|
-
if (!data
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
155
|
+
}).optional().superRefine((data, ctx) => {
|
|
156
|
+
if (!data) return;
|
|
157
|
+
|
|
158
|
+
const diff = Math.abs(
|
|
159
|
+
data.startDate.getTime() - data.endDate.getTime()
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
if (diff > 2 * 60 * 60 * 1000) {
|
|
163
|
+
ctx.addIssue({
|
|
164
|
+
path: ['endDate'],
|
|
165
|
+
message: 'Schedule must be within 2 hours of original',
|
|
166
|
+
code: z.ZodIssueCode.custom,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
162
169
|
})
|
|
163
170
|
});
|
|
164
171
|
|