use regex

fix/booking-limits
CarinaWolli 2023-10-31 15:30:44 -04:00
parent f54c5675d6
commit a5f906b9b6
1 changed files with 4 additions and 1 deletions

View File

@ -205,7 +205,10 @@ export const stringOrNumber = z.union([
z.number().int(), z.number().int(),
]); ]);
export const stringToDayjs = z.string().transform((val) => dayjs(val).utcOffset(val.slice(-6))); export const stringToDayjs = z.string().transform((val) => {
const timezone = val.match(/([+-]\d{2}:\d{2})$/)[1];
return dayjs(val).utcOffset(timezone);
});
export const bookingCreateBodySchema = z.object({ export const bookingCreateBodySchema = z.object({
end: z.string().optional(), end: z.string().optional(),