2
0
Files
cal/calcom/apps/api/v1/lib/validations/shared/timeZone.ts
2024-08-09 00:39:27 +02:00

8 lines
350 B
TypeScript

import tzdata from "tzdata";
import { z } from "zod";
// @note: This is a custom validation that checks if the timezone is valid and exists in the tzdb library
export const timeZone = z.string().refine((tz: string) => Object.keys(tzdata.zones).includes(tz), {
message: `Expected one of the following: ${Object.keys(tzdata.zones).join(", ")}`,
});