Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/integrations/src/google.ts
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,8 @@ export class GoogleClient {
id: z.string().min(1),
summary: z.string().default("(Untitled calendar)"),
summaryOverride: z.string().optional(),
timeZone: z.string(),
// Google marks the calendar time zone as optional.
timeZone: z.string().default("UTC"),
accessRole: z.string(),
}),
)
Expand Down Expand Up @@ -533,7 +534,8 @@ export class GoogleClient {
const timeZone =
current.start.timeZone ??
z
.object({ timeZone: z.string().min(1) })
// Google marks the calendar time zone as optional.
.object({ timeZone: z.string().min(1).default("UTC") })
.parse(
await this.request(`${CALENDAR}/users/me/calendarList/${encodeURIComponent(calendarId)}`),
).timeZone;
Expand Down
33 changes: 33 additions & 0 deletions tests/google.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -719,6 +719,39 @@ test("calendar discovery follows pagination and retains names, zones, and access
]);
});

test("calendars without an explicit time zone still list with a UTC fallback", async () => {
const client = clientWith(() =>
json({
items: [
{
id: "shared@example.com",
summary: "Family",
accessRole: "reader",
},
],
}),
);
assert.deepEqual(await client.listCalendars(), [
{
id: "shared@example.com",
name: "Family",
timeZone: "UTC",
accessRole: "reader",
},
]);
});

test("event review falls back to UTC when neither the event nor its calendar has a zone", async () => {
const client = clientWith((request) => {
const path = new URL(request.url).pathname;
if (path.endsWith("/calendarList/primary"))
return json({ id: "primary", summary: "Personal", accessRole: "owner" });
return json({ ...eventResponse, start: { dateTime: "2026-10-10T10:00:00-07:00" } });
});
const { event } = await client.reviewEvent("primary", "event-1");
assert.equal(event.timeZone, "UTC");
});

test("recurring masters and occurrences are rejected from fresh Google data before updates or deletes", async () => {
for (const recurrence of [
{ recurrence: ["RRULE:FREQ=WEEKLY"] },
Expand Down