Skip to content

A personal agent with a browser, terminal, files, and work that keeps going built with CopilotKit and AG-UI.

TypeScript

fix: list calendars without an explicit time zone (#98)

nvtoan0201-swe09eaab2530e6
diff --git a/packages/integrations/src/google.ts b/packages/integrations/src/google.ts
index 406249c..24b031a 100644
--- a/packages/integrations/src/google.ts
+++ b/packages/integrations/src/google.ts
@@ -501,7 +501,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(),
}),
)
@@ -553,7 +554,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;
diff --git a/tests/google.test.ts b/tests/google.test.ts
index 582edeb..9b06c4f 100644
--- a/tests/google.test.ts
+++ b/tests/google.test.ts
@@ -768,6 +768,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: [
+ {
+ summary: "Family",
+ accessRole: "reader",
+ },
+ ],
+ }),
+ );
+ assert.deepEqual(await client.listCalendars(), [
+ {
+ 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("bounded calendar pages retain completeness independently of item count", async () => {
for (const [count, nextPageToken, truncated] of [
[0, "next-page", true],