Use transform instead of preprocess of days array to set in config schema

This commit is contained in:
Xevion
2023-02-27 19:04:46 -06:00
parent e07bd4c1f7
commit 546835f30c

View File

@@ -45,10 +45,9 @@ const TimeConfigSchema = z.object({
return parsed;
}),
// The days this configuration is active on.
days: z.preprocess((v) => {
const parsedArray = z.any().array().parse(v);
return new Set(parsedArray);
}, z.set(DayEnumSchema).nonempty()),
days: z.array(DayEnumSchema).nonempty().transform(arr => {
return new Set<DayEnum>(arr);
}),
// If a notification isn't delivery within 10 minutes e.g. "00:30", 24 hour time
maxLate: z
.string()