Skip to content

Conversation

@rodrigoehlers
Copy link
Contributor

@rodrigoehlers rodrigoehlers commented Oct 24, 2025

What does this PR do?

This PR adds failing test cases that demonstrate a timezone bug in recurring bookings for users in CET (Central European Time). The tests are intentionally failing to show the bug before the fix is applied.

Bug Description: When a user in CET selects a recurring meeting time (e.g., 10:00 AM), the system generates bookings at the wrong time (11:00 AM) due to timezone-naive date parsing in the parseRecurringDates function.

Root Cause: The parseRecurringDates function in packages/lib/parse-dates.ts uses dayjs(startDate) without timezone context, causing dates to be parsed in the execution environment's timezone rather than the user's selected timezone.


Session Info:


Test Coverage

Two test cases are added:

  1. Basic CET timezone test: Verifies that weekly recurring bookings maintain the correct time (10:00 AM) in CET timezone
  2. DST transition test: Ensures recurring bookings handle Daylight Saving Time transitions correctly

Both tests currently fail, showing times at 11:00 instead of 10:00 (1-hour offset).

How should this be tested?

Run the tests with:

TZ=UTC yarn test packages/lib/parse-dates.test.ts

Expected behavior: Tests should fail, demonstrating the bug

  • First test expects 10:00, gets 11:00
  • Second test expects 10:00, gets 11:00

Next Steps

After CI confirms these tests fail as expected, a follow-up PR will apply the fix:

// In parseRecurringDates function
// Change from:
const startUtcOffset = dayjs(startDate).utcOffset();
dtstart: new Date(dayjs(startDate).valueOf())

// To:
const startUtcOffset = dayjs.tz(startDate, timeZone).utcOffset();
dtstart: new Date(dayjs.tz(startDate, timeZone).valueOf())

Mandatory Tasks

  • I have self-reviewed the code
  • I have updated the developer docs - N/A (test-only PR)
  • I confirm automated tests are in place that prove my fix is effective or that my feature works (tests are added, intentionally failing to demonstrate the bug)

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have checked if my changes generate no new warnings

Summary by cubic

Adds two failing tests that reproduce the recurring booking timezone bug for CET users, where a 10:00 selection is generated at 11:00. The cases expose timezone‑naive parsing in parseRecurringDates and cover both weekly recurrence and a DST transition.

This test demonstrates the timezone bug where recurring bookings are
calculated incorrectly when the user's timezone (CET) differs from the
execution environment timezone.

The test shows that when a user in CET selects 10:00 AM for recurring
meetings, the dates are generated at 11:00 AM instead, off by 1 hour.

This is caused by timezone-naive date parsing in parseRecurringDates
function where dayjs(startDate) parses without timezone context.

Co-Authored-By: [email protected] <[email protected]>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@keithwillcode keithwillcode added consumer core area: core, team members only labels Oct 24, 2025
This fixes the recurring booking timezone bug where bookings were
generated at incorrect times for users in different timezones (e.g., CET).

The fix ensures that:
1. startDate is parsed in the user's selected timezone using dayjs.tz()
2. UTC offset calculations use the correct timezone context
3. DST transitions are handled correctly

Changes:
- Line 102: Use dayjs.tz(startDate, timeZone) instead of dayjs(startDate)
- Line 105: Use dayjs.tz(startDate, timeZone) for offset calculation
- Line 109: Use dayjs(t).tz(timeZone) for DST offset calculation

Tests now pass, confirming recurring bookings are generated at the
correct time in the user's timezone.

Co-Authored-By: [email protected] <[email protected]>
@vercel
Copy link

vercel bot commented Oct 24, 2025

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

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
cal Ignored Ignored Oct 24, 2025 9:56am
cal-eu Ignored Ignored Oct 24, 2025 9:56am

@sean-brydon sean-brydon requested a review from emrysal October 24, 2025 08:27
@sean-brydon sean-brydon marked this pull request as ready for review October 24, 2025 08:27
@graphite-app graphite-app bot requested a review from a team October 24, 2025 08:27
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

@github-actions
Copy link
Contributor

github-actions bot commented Oct 24, 2025

E2E results are ready!

Copy link
Contributor

@eunjae-lee eunjae-lee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Nice catch!

Copy link
Member

@CarinaWolli CarinaWolli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saw this bug that I can't reproduce in main: https://www.loom.com/share/2bb22bc242164e6b9af79069919ab451

@rodrigoehlers
Copy link
Contributor Author

Closing this since it was a local timezone issue with Node.js using the system timezone by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

consumer core area: core, team members only ready-for-e2e size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants