Skip to content

fix(provider-utils): read offset-less event times in their own time zone - #37

Merged
vkpdeveloper merged 2 commits into
mainfrom
fix/local-event-times
Nov 5, 2026
Merged

vkpdeveloper merged 2 commits into
mainfrom
fix/local-event-times

Conversation

@vkpdeveloper

Copy link
Copy Markdown
Owner

eventTimeToInstant parsed a timed dateTime with Date.parse. When the value has no offset, such as { dateTime: '2026-11-09T10:00:00', timeZone: 'Europe/Berlin' } (the form the README and docs use), that reads it in the host machine's zone and ignores timeZone. The mock calendar uses this for busy times, listing windows and recurrence expansion, so on a machine in IST a 10:00 Berlin meeting was reported busy at 04:30Z instead of 09:00Z, and findFreeTime offered slots on top of it. Real providers aren't affected: they send the wall-clock time and zone to the API.

Offset-less values are now parsed as wall-clock time in their own timeZone with the existing localToInstant. Values with an offset or Z still go through Date.parse.

Verified

  • New test (Berlin in winter, New York in summer) fails on the old code under TZ=Asia/Kolkata (expected 09:00Z, got 04:30Z) and passes with the fix.
  • Mock repro under TZ=Asia/Kolkata: getFreeBusy now returns 09:00Z to 11:00Z for a 10:00 to 12:00 Berlin event.
  • Full test suite passes under TZ=UTC and TZ=America/Los_Angeles; lint and typecheck clean.

@vercel

vercel Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
calsdk Ready Ready Preview Nov 5, 2026 7:59pm UTC

@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 50 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7c314cc6-b441-4040-ad24-7046a99b09cb
Commits

Reviewing files that changed from the base of the PR and between e919a96 and 34020f6.

Files selected for processing: 3

  • .changeset/local-event-times.md
  • packages/provider-utils/src/time/event-time.ts
  • packages/provider-utils/src/time/time.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

eventTimeToInstant parsed a dateTime without an offset with Date.parse,
so it used the host's zone and ignored timeZone. The mock calendar
then reported busy times hours off wherever the host zone differed
from the event's.
@vkpdeveloper
vkpdeveloper merged commit 913c8a0 into main Nov 5, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
Preview — 34020f64 Deployed Nov 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant