@careflair/common 1.0.32 → 1.0.33
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/schemas/forms.d.ts +13 -1
- package/dist/schemas/forms.js +12 -1
- package/package.json +1 -1
package/dist/schemas/forms.d.ts
CHANGED
|
@@ -195,7 +195,7 @@ export declare const EducationAndTrainingFormSchema: z.ZodEffects<z.ZodEffects<z
|
|
|
195
195
|
/**
|
|
196
196
|
* Work history form schema
|
|
197
197
|
*/
|
|
198
|
-
export declare const WorkHistoryFormSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
198
|
+
export declare const WorkHistoryFormSchema: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
199
199
|
jobTitle: z.ZodString;
|
|
200
200
|
organisation: z.ZodString;
|
|
201
201
|
startDate: z.ZodEffects<z.ZodString, string, string>;
|
|
@@ -249,4 +249,16 @@ export declare const WorkHistoryFormSchema: z.ZodEffects<z.ZodEffects<z.ZodEffec
|
|
|
249
249
|
organisation: string;
|
|
250
250
|
endDate?: string | undefined;
|
|
251
251
|
isCurrentlyWorking?: boolean | undefined;
|
|
252
|
+
}>, {
|
|
253
|
+
startDate: string;
|
|
254
|
+
jobTitle: string;
|
|
255
|
+
organisation: string;
|
|
256
|
+
isCurrentlyWorking: boolean;
|
|
257
|
+
endDate?: string | undefined;
|
|
258
|
+
}, {
|
|
259
|
+
startDate: string;
|
|
260
|
+
jobTitle: string;
|
|
261
|
+
organisation: string;
|
|
262
|
+
endDate?: string | undefined;
|
|
263
|
+
isCurrentlyWorking?: boolean | undefined;
|
|
252
264
|
}>;
|
package/dist/schemas/forms.js
CHANGED
|
@@ -199,6 +199,16 @@ exports.WorkHistoryFormSchema = zod_1.z
|
|
|
199
199
|
}, {
|
|
200
200
|
message: "End date must be after start date",
|
|
201
201
|
path: ["endDate"],
|
|
202
|
+
})
|
|
203
|
+
.refine((data) => {
|
|
204
|
+
// If endDate is provided, validate it's not in the future
|
|
205
|
+
if (data.endDate && data.endDate.length > 0) {
|
|
206
|
+
return !isDateInFuture(data.endDate);
|
|
207
|
+
}
|
|
208
|
+
return true;
|
|
209
|
+
}, {
|
|
210
|
+
message: "End date cannot be in the future",
|
|
211
|
+
path: ["endDate"],
|
|
202
212
|
})
|
|
203
213
|
.refine((data) => {
|
|
204
214
|
// If endDate is provided, validate there's at least 1 month difference
|
|
@@ -216,7 +226,8 @@ exports.WorkHistoryFormSchema = zod_1.z
|
|
|
216
226
|
if (data.endDate && data.endDate.length > 0) {
|
|
217
227
|
return !data.isCurrentlyWorking;
|
|
218
228
|
}
|
|
219
|
-
|
|
229
|
+
// If no endDate, isCurrentlyWorking must be true
|
|
230
|
+
return data.isCurrentlyWorking;
|
|
220
231
|
}, {
|
|
221
232
|
message: "If there is an endDate, Currently Working must be false. If Currently Working is false, endDate must be provided.",
|
|
222
233
|
path: ["endDate", "isCurrentlyWorking"],
|