{"record":{"id":"e95d09e161ce8660","repo":"calcom/cal.diy","slug":"could-not-adjust-timezone-for-slot-slot-time-wi","errorCode":null,"errorMessage":"Could not adjust timezone for slot ${slot.time} with timezone ${timeZone}","messagePattern":"Could not adjust timezone for slot (.+?) with timezone (.+?)","errorType":"http","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"apps/api/v2/src/modules/slots/slots-2024-09-04/services/slots-output.service.ts","lineNumber":65,"sourceCode":"    const slots: { [key: string]: (Slot_2024_09_04 | SeatedSlot_2024_09_04)[] } = {};\n    for (const date in availableSlots.slots) {\n      const availableTimeSlots = availableSlots.slots[date].filter((slot) => !slot.away);\n      if (availableTimeSlots.length > 0) {\n        slots[date] = availableTimeSlots.map((slot) => {\n          if (!timeZone) {\n            if (!eventType?.seatsPerTimeSlot) {\n              return this.getAvailableTimeSlot(slot.time);\n            }\n            return this.getAvailableTimeSlotSeated(\n              slot.time,\n              slot.attendees || 0,\n              eventType.seatsPerTimeSlot || 0,\n              slot.bookingUid\n            );\n          }\n          const slotTimezoneAdjusted = DateTime.fromISO(slot.time, { zone: \"utc\" }).setZone(timeZone).toISO();\n          if (!slotTimezoneAdjusted) {\n            throw new BadRequestException(\n              `Could not adjust timezone for slot ${slot.time} with timezone ${timeZone}`\n            );\n          }\n          if (!eventType?.seatsPerTimeSlot) {\n            return this.getAvailableTimeSlot(slotTimezoneAdjusted);\n          }\n          return this.getAvailableTimeSlotSeated(\n            slotTimezoneAdjusted,\n            slot.attendees || 0,\n            eventType.seatsPerTimeSlot || 0,\n            slot.bookingUid\n          );\n        });\n      }\n    }\n\n    return slots;\n  }","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/apps/api/v2/src/modules/slots/slots-2024-09-04/services/slots-output.service.ts#L47-L83","documentation":"A NestJS BadRequestException (HTTP 400) from SlotsOutputService_2024_09_04.getAvailableTimeSlots. When a timeZone is supplied, DateTime.fromISO(slot.time,{zone:'utc'}).setZone(timeZone).toISO() returned null. This means either the requested timeZone is not recognized by luxon or the internal slot.time value is corrupt. Format is the default 'time' (non-range) slot output.","triggerScenarios":"Calling GET /v2/slots/2024-09-04 with a `timeZone` query param that luxon cannot resolve (typo like 'Europ/Berlin', an IANA name that is not installed, or a non-IANA abbreviation like 'EST' that luxon does not accept). Less commonly, the upstream availableSlots service returned a slot.time that is not a valid ISO string.","commonSituations":"Using browser Intl.timezone that returns an empty string; passing 'UTC'/'GMT' abbreviations; user-supplied timezone from a free-text field; outdated luxon timezone database on the server.","solutions":["Use canonical IANA timezone names (e.g. 'Europe/Berlin', 'America/New_York') and validate with Intl.supportedValuesOf('timeZone') or luxon's DateTime.now().setZone(tz).isValid before the request.","Trim and verify the timeZone string is non-empty.","If you don't need conversion, omit timeZone entirely to fall back to UTC output.","On the server, ensure the luxon/full-icu data is available so all IANA zones resolve."],"exampleFix":"// before\nfetch(`/v2/slots?...&timeZone=${tz}`)  // tz = 'EST'\n\n// after\nconst valid = DateTime.now().setZone(tz).isValid;\nif (!valid) throw new ClientError(`Unsupported timezone: ${tz}`);\nfetch(`/v2/slots?...&timeZone=${encodeURIComponent(tz)}`);","handlingStrategy":"validation","validationCode":"import { DateTime } from 'luxon';\n\nfunction assertValidTimezone(tz: unknown): string | undefined {\n  if (tz === undefined || tz === null || tz === '') return undefined;\n  if (typeof tz !== 'string') throw new TypeError('timeZone must be a string');\n  const probe = DateTime.now().setZone(tz);\n  if (!probe.isValid) throw new RangeError(`Unsupported timeZone: ${tz} (${probe.invalidReason})`);\n  return tz;\n}\nconst timeZone = assertValidTimezone(input.timeZone);","typeGuard":"function isIANATimezone(v: unknown): v is string {\n  if (typeof v !== 'string' || v.trim() === '') return false;\n  return DateTime.now().setZone(v).isValid;\n}","tryCatchPattern":"try {\n  await cal.slots.list({ ..., timeZone });\n} catch (e) {\n  if (e instanceof HttpError && e.statusCode === 400 && /timezone/i.test(e.message)) {\n    // retry once in UTC, or re-prompt for a valid zone\n    return cal.slots.list({ ..., /* timeZone omitted */ });\n  }\n  throw e;\n}","preventionTips":["Use canonical IANA zone names from Intl.supportedValuesOf('timeZone').","Omit timeZone entirely if you can consume UTC output.","Validate the zone with luxon before sending.","Ensure full-ICU is available on the server runtime."],"tags":["calcom-api","slots","bad-request","luxon","timezone","output-formatting"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}