Skip to content

Fix Outlook & Zoom creating events in UTC#7283

Merged
zomars merged 2 commits intomainfrom
fix-outlook-utc-bug
Feb 24, 2023
Merged

Fix Outlook & Zoom creating events in UTC#7283
zomars merged 2 commits intomainfrom
fix-outlook-utc-bug

Conversation

@joeauyeung
Copy link
Copy Markdown
Contributor

What does this PR do?

This PR fixes events being created in UTC on Outlook & Zoom.

Fixes #6928, fixes #6927

Environment: Staging(main branch) / Production

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How should this be tested?

  • Connect Outlook & Zoom
  • Create an event
  • On Outlook & Zoom the events should have been made in your set timezone

Checklist

  • I haven't read the contributing guide
  • My code doesn't follow the style guidelines of this project
  • I haven't performed a self-review of my own code and corrected any misspellings
  • I haven't commented my code, particularly in hard-to-understand areas
  • I haven't checked if my PR needs changes to the documentation
  • I haven't checked if my changes generate no new warnings
  • I haven't added tests that prove my fix is effective or that my feature works
  • I haven't checked if new and existing unit tests pass locally with my changes

@joeauyeung joeauyeung requested a review from a team February 22, 2023 18:16
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 22, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
cal ❌ Failed (Inspect) Feb 22, 2023 at 7:06PM (UTC)
1 Ignored Deployment
Name Status Preview Comments Updated
ui ⬜️ Ignored (Inspect) Feb 22, 2023 at 7:06PM (UTC)

Copy link
Copy Markdown
Contributor Author

@joeauyeung joeauyeung left a comment

Choose a reason for hiding this comment

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

When we would pass event start & end times it would be formatted as 2023-02-22T18:00:00Z. The Z at the end would overwrite any time zones we would pass.

};

private translateEvent = (event: CalendarEvent) => {
const utcOffset = dayjs(event.startTime, event.organizer.timeZone).utcOffset() / 60;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We need to apply the UTC offset because we are passing the start & end times as UTC.

@github-actions
Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Analysis

This analysis was generated by the next.js bundle analysis action 🤖

This PR introduced no changes to the javascript bundle 🙌

@zomars zomars merged commit 944ff68 into main Feb 24, 2023
@zomars zomars deleted the fix-outlook-utc-bug branch February 24, 2023 00:18
fritterhoff pushed a commit to hm-edu/cal.com that referenced this pull request Feb 26, 2023
* Apply utc offset to time strings

* Zoom, create events in proper time zone
Mythie pushed a commit to Mythie/cal.com that referenced this pull request Mar 5, 2023
* Apply utc offset to time strings

* Zoom, create events in proper time zone
dmkav pushed a commit to join-com/cal-com that referenced this pull request Mar 6, 2023
* Apply utc offset to time strings

* Zoom, create events in proper time zone
};

const recurrence = getRecurrence(event);
const utcOffset = dayjs(event.startTime, event.organizer.timeZone).utcOffset() / 60;
Copy link
Copy Markdown

@lott-ai lott-ai Mar 16, 2023

Choose a reason for hiding this comment

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

@zomars @joeauyeung I believe this code dayjs(event.startTime, event.organizer.timeZone) is resulting in NaN, which is setting the start_time on L204 to be the current time.

I can reproduce this consistently:

#6928 (comment)

I just tried it again today (3/16) at 2:47pm with the following parameters:

Scheduled the meeting for 3/18 at 11am.

image

And the zoom meeting was scheduled for today (3/16) at 2:47pm.

image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for finding this @lottamus. I'll look into it

@PeerRich PeerRich added the core area: core, team members only label Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core area: core, team members only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Zoom being being set to UTC (wrong time), after confirming a meeting. Office 365 Calendar Meeting being booked in UTC

4 participants