Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
🐛 Send Webex meeting times with the meeting time zone's offset (#3445)
Luke Vellad15da7e75af3
diff --git a/apps/web/src/features/conferencing/service.ts b/apps/web/src/features/conferencing/service.tsindex deb403a00..482e8b405 100644--- a/apps/web/src/features/conferencing/service.ts+++ b/apps/web/src/features/conferencing/service.ts@@ -14,6 +14,7 @@ import { MICROSOFT_TEAMS_SCOPES, WEBEX_SCOPES } from "./constants";import { getConferencingConnectionForProvider } from "./data";import type { Conferencing, ConferencingProvider } from "./schema";import {+ formatWebexDateTime,getMicrosoftTeamsAuthority,getWebexMeetingWindow,isTeamsMeetingRefusal,@@ -361,8 +362,8 @@ async function createWebexMeeting({},body: JSON.stringify({title: title.slice(0, 128),- start: window.start.toISOString(),- end: window.end.toISOString(),+ start: formatWebexDateTime({ date: window.start, timeZone }),+ end: formatWebexDateTime({ date: window.end, timeZone }),sendEmail: false,...(timeZone ? { timezone: timeZone } : {}),}),diff --git a/apps/web/src/features/conferencing/utils.test.ts b/apps/web/src/features/conferencing/utils.test.tsindex a5b1e6e50..a12ee9f9e 100644--- a/apps/web/src/features/conferencing/utils.test.ts+++ b/apps/web/src/features/conferencing/utils.test.ts@@ -3,6 +3,7 @@ import { describe, expect, it } from "vitest";import { conferencingSchema } from "./schema";import {createZoomUrlValidationResponse,+ formatWebexDateTime,getConferencingUri,getMicrosoftTeamsAuthority,getWebexMeetingWindow,@@ -151,6 +152,37 @@ describe("webexMeetingToConferencing", () => {});});+describe("formatWebexDateTime", () => {+ const date = new Date("2026-10-16T11:00:00Z");++ it("writes a zoned time with that zone's offset", () => {+ expect(formatWebexDateTime({ date, timeZone: "Europe/London" })).toBe(+ "2026-10-16T12:00:00+01:00",+ );+ expect(formatWebexDateTime({ date, timeZone: "America/New_York" })).toBe(+ "2026-10-16T07:00:00-04:00",+ );+ expect(formatWebexDateTime({ date, timeZone: "Asia/Kolkata" })).toBe(+ "2026-10-16T16:30:00+05:30",+ );+ });++ it("follows the offset in force on the day", () => {+ expect(+ formatWebexDateTime({+ date: new Date("2026-12-01T11:00:00Z"),+ timeZone: "Europe/London",+ }),+ ).toBe("2026-12-01T11:00:00+00:00");+ });++ it("writes a floating time in UTC", () => {+ expect(formatWebexDateTime({ date, timeZone: null })).toBe(+ "2026-10-16T11:00:00.000Z",+ );+ });+});+describe("getWebexMeetingWindow", () => {const now = new Date("2026-10-03T09:00:30Z");diff --git a/apps/web/src/features/conferencing/utils.ts b/apps/web/src/features/conferencing/utils.tsindex b4c48d9fc..39f5a8b5d 100644--- a/apps/web/src/features/conferencing/utils.ts+++ b/apps/web/src/features/conferencing/utils.ts@@ -1,4 +1,5 @@import * as z from "zod";+import { instantToWallTime } from "@/lib/datetime/wall-time";import type { Conferencing, ConferencingProvider } from "./schema";// Which OAuth integration backs each provider. Google Meet shares the Google@@ -167,6 +168,32 @@ export function getWebexMeetingWindow({};}+// Webex rejects a time whose offset differs from the meeting's `timezone`, so+// a zoned meeting is written as that zone's wall time with its offset+// (2026-10-16T12:00:00+01:00) and a floating one in UTC.+export function formatWebexDateTime({+ date,+ timeZone,+}: {+ date: Date;+ timeZone?: string | null;+}) {+ if (!timeZone) {+ return date.toISOString();+ }+ const wallTime = instantToWallTime(date, timeZone);+ const offsetMinutes = Math.round(+ (Date.parse(`${wallTime}Z`) - date.getTime()) / 60_000,+ );+ const sign = offsetMinutes < 0 ? "-" : "+";+ const hours = String(Math.floor(Math.abs(offsetMinutes) / 60)).padStart(+ 2,+ "0",+ );+ const minutes = String(Math.abs(offsetMinutes) % 60).padStart(2, "0");+ return `${wallTime}${sign}${hours}:${minutes}`;+}+// Graph's online meetings API serves work and school accounts only, so a// multitenant registration connects Teams through the `organizations`// authority, which keeps personal accounts from starting the flow. A single