Scheduling infrastructure for absolutely everyone.
fix: Update timeZoneSchema to handle +00:00 timezone case and maintain IANA compliance (#25776)
Hariom Balhara0ecfd78e47ee
diff --git a/packages/lib/dayjs/timeZone.schema.ts b/packages/lib/dayjs/timeZone.schema.tsindex 920ad9c2257..1edea4f99f9 100644--- a/packages/lib/dayjs/timeZone.schema.ts+++ b/packages/lib/dayjs/timeZone.schema.ts@@ -3,6 +3,18 @@ import { z } from "zod";import { isSupportedTimeZone } from "./index";// Schema for validating IANA timezone strings compatible with Intl.DateTimeFormat-export const timeZoneSchema = z.string().refine((timeZone) => isSupportedTimeZone(timeZone), {- message: "Invalid timezone. Must be a valid IANA timezone string.",-});+// Browserstack and some automations return +00:00 as the timezone which isn't a valid IANA timezone+// @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/resolvedOptions#timezone+export const timeZoneSchema = z+ .string()+ .refine(+ (timeZone) => {+ // Allow +00:00 as a special case - it will be transformed to UTC+ if (timeZone === "+00:00") {+ return true;+ }+ return isSupportedTimeZone(timeZone);+ },+ { message: "Invalid timezone. Must be a valid IANA timezone string." }+ )+ .transform((timeZone) => (timeZone === "+00:00" ? "UTC" : timeZone));