Skip to content

Conversation

@jeanfbrito
Copy link
Contributor

@jeanfbrito jeanfbrito commented Oct 27, 2025

What Was Happening

Users were receiving calendar event notifications from Outlook/Exchange that displayed event times in the wrong timezone.
For example, if you had a meeting scheduled for 2:00 PM in New York, the notification might show it as 6:00 PM UTC or some other incorrect time, making it confusing to know when you actually needed to attend because it was using the server's timezone.

What's Now Fixed

The calendar notification system now properly converts event times to display in each user's local timezone.

Examples of the fix:

Event Scheduled User Location Notification Now Shows
2:00 PM in New York New York (EST) 2:00 PM
2:00 PM in New York Los Angeles (PST) 11:00 AM
2:00 PM in New York London (GMT) 7:00 PM
10:00 AM in Tokyo Tokyo (JST) 10:00 AM
10:00 AM in Tokyo Berlin (CET) 2:00 AM

This ensures that when you receive a calendar notification, the time displayed matches your local timezone, eliminating confusion about when your events are actually happening, regardless of where you're located in the world, based on your machine's timezone.

Proposed changes (including videos or screenshots)

Issue(s)

https://rocketchat.atlassian.net/browse/SUP-902

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • New Features
    • Calendar notifications now show event start times when available, converted to the user's local time and displayed in a concise, user-friendly format. If time conversion fails, the original notification text is preserved.
  • Chores
    • Minor package/version updates to support the new notification time display.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Oct 27, 2025

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Oct 27, 2025

🦋 Changeset detected

Latest commit: b438de0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 41 packages
Name Type
@rocket.chat/meteor Minor
@rocket.chat/core-typings Minor
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/freeswitch Patch
@rocket.chat/fuselage-ui-kit Major
@rocket.chat/gazzodown Major
@rocket.chat/http-router Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/rest-typings Minor
@rocket.chat/ui-avatar Major
@rocket.chat/ui-client Major
@rocket.chat/ui-contexts Major
@rocket.chat/web-ui-registration Major
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/license Patch
@rocket.chat/media-calls Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/mock-providers Patch
@rocket.chat/models Patch
@rocket.chat/ui-video-conf Major
@rocket.chat/ui-voip Major
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 27, 2025

Walkthrough

Server adds startTimeUtc (event.startTime ISO string) to calendar notification payload; client formats that UTC timestamp into a locale-specific time and uses it as the notification body when present (falls back to original text on error); typings updated to include optional startTimeUtc on the calendar notification payload.

Changes

Cohort / File(s) Summary
Type Definitions
packages/core-typings/src/INotification.ts
Added optional startTimeUtc?: string to ICalendarNotification.payload.
Server — Calendar Notifications
apps/meteor/server/services/calendar/service.ts
When constructing calendar notifications, include startTimeUtc: event.startTime.toISOString() in the payload.
Client — Notification Formatting
apps/meteor/client/views/root/hooks/loggedIn/useNotificationUserCalendar.ts
If notification.payload.startTimeUtc exists, parse and format it to a locale-specific time string (hour:minute with narrow dayPeriod) and use as notification body; on parse/format error, log and fall back to original notification.text.

Sequence Diagram

sequenceDiagram
    actor User
    participant Server
    participant Client
    participant DB as CalendarEventDB

    Server->>DB: fetch event for notification
    Server->>Server: build payload (include startTimeUtc = event.startTime.toISOString())
    Server->>Client: send notification with payload

    alt payload contains startTimeUtc
        Client->>Client: parse startTimeUtc → format to locale time (HH:MM + dayPeriod)
        Client->>Client: set notification body to formatted time
        Client->>User: display enhanced notification
    else no startTimeUtc or format error
        Client->>User: display original notification text
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Check server usage of event.startTime and that time zone conversion intent is satisfied by toISOString().
  • Verify client parsing/Intl formatting handles invalid strings and locales; confirm logged errors are actionable.
  • Ensure the optional typing change is backward-compatible and doesn't break consumers.

Poem

🐇 I hopped through code with a tiny cheer,
I tucked an ISO time so the hour feels near,
The client reads it, makes the minutes sing,
If parsing trips, the old text still clings,
Now notifications hum — punctual and clear.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "fix: outlook notification showing event time in the wrong timezone" directly and specifically summarizes the primary change in the changeset. The code modifications across three files (useNotificationUserCalendar.ts, calendar/service.ts, and INotification.ts) all work together to implement timezone conversion for calendar notifications, converting UTC time to the recipient's local timezone. The title is clear, concise, and accurately reflects the main objective without being vague or overly broad.
Linked Issues Check ✅ Passed The code changes directly address the objectives outlined in linked issue SUP-902. The modifications implement timezone conversion for Outlook calendar notifications by: adding a startTimeUtc field to the notification payload (INotification.ts and calendar/service.ts), extracting the event's UTC start time, and then formatting it to the recipient's local timezone in the notification body (useNotificationUserCalendar.ts). This ensures event times are displayed in each user's local timezone rather than the server timezone, which was the core requirement of the linked issue.
Out of Scope Changes Check ✅ Passed All changes in the pull request are directly scoped to fixing the timezone display issue for Outlook calendar notifications. The modifications to useNotificationUserCalendar.ts implement timezone-aware formatting, calendar/service.ts adds UTC timestamp extraction to the notification payload, INotification.ts extends the type definition to support the new field, and the changeset documents these related changes. No unrelated refactoring, unrelated feature additions, or tangential modifications were detected.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/outlook-timezone

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 3437674 and dae244c.

📒 Files selected for processing (1)
  • packages/core-typings/src/INotification.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/core-typings/src/INotification.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Oct 27, 2025

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.91%. Comparing base (5c57e84) to head (b438de0).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #37318      +/-   ##
===========================================
- Coverage    67.93%   67.91%   -0.03%     
===========================================
  Files         3356     3356              
  Lines       114886   114894       +8     
  Branches     20758    20755       -3     
===========================================
- Hits         78049    78031      -18     
- Misses       34152    34175      +23     
- Partials      2685     2688       +3     
Flag Coverage Δ
e2e 57.42% <0.00%> (-0.03%) ⬇️
unit 71.99% <ø> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jeanfbrito jeanfbrito marked this pull request as ready for review October 28, 2025 02:10
@jeanfbrito jeanfbrito requested review from a team as code owners October 28, 2025 02:10
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/meteor/server/services/calendar/service.ts (1)

353-360: Critical: Server-side time formatting conflicts with client-side timezone correction.

Line 355 formats the time using the server's locale and timezone by calling toLocaleTimeString(undefined, ...). When the client receives this notification, it appends the correctly formatted user-timezone time (from line 358's startTimeUtc), resulting in a notification body with two conflicting times.

Example scenario:

  • Event at 2025-01-15T14:00:00Z
  • Server (UTC): formats as "2:00 PM"
  • Client (EST): formats as "9:00 AM"
  • Final notification: "2:00 PM - 9:00 AM" ❌

Recommended fix:

Since the client now handles timezone-aware formatting using startTimeUtc, remove the time formatting from the server-side text field:

 return api.broadcast('notify.calendar', event.uid, {
     title: event.subject,
-    text: event.startTime.toLocaleTimeString(undefined, { hour: 'numeric', minute: 'numeric', dayPeriod: 'narrow' }),
+    text: event.subject,
     payload: {
         _id: event._id,
         startTimeUtc: event.startTime.toISOString(),
     },
 });

Alternatively, if you want to preserve backwards compatibility for clients without the startTimeUtc handling, conditionally format:

text: event.subject, // Client will append time when startTimeUtc is present

This ensures the client properly displays: "Meeting Title at 9:00 AM" in the user's local timezone.

🧹 Nitpick comments (1)
apps/meteor/client/views/root/hooks/loggedIn/useNotificationUserCalendar.ts (1)

28-31: Consider adding the event ID to the error log for debugging.

While the error handling is correct, including the event ID would help trace issues for specific calendar events.

 } catch (error) {
-    console.error('Failed to format calendar notification time:', error);
+    console.error(`Failed to format calendar notification time for event ${notification.payload._id}:`, error);
     body = notification.text;
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 688786a and 6bbbb94.

📒 Files selected for processing (3)
  • apps/meteor/client/views/root/hooks/loggedIn/useNotificationUserCalendar.ts (1 hunks)
  • apps/meteor/server/services/calendar/service.ts (1 hunks)
  • packages/core-typings/src/INotification.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build
🔇 Additional comments (1)
packages/core-typings/src/INotification.ts (1)

77-77: LGTM: Type definition correctly supports the timezone fix.

The optional startTimeUtc field properly enables the client to format notifications in the user's timezone while maintaining backwards compatibility.

@jeanfbrito jeanfbrito added the stat: QA assured Means it has been tested and approved by a company insider label Oct 28, 2025
@scuciatto scuciatto added stat: QA assured Means it has been tested and approved by a company insider and removed stat: QA assured Means it has been tested and approved by a company insider labels Oct 30, 2025
@scuciatto scuciatto added this to the 7.13.0 milestone Oct 30, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Oct 30, 2025
@dionisio-bot dionisio-bot bot removed the stat: ready to merge PR tested and approved waiting for merge label Oct 30, 2025
@scuciatto scuciatto added stat: QA assured Means it has been tested and approved by a company insider and removed stat: QA assured Means it has been tested and approved by a company insider labels Oct 30, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Oct 30, 2025
@kodiakhq kodiakhq bot merged commit 65fbcbe into develop Oct 30, 2025
51 checks passed
@kodiakhq kodiakhq bot deleted the fix/outlook-timezone branch October 30, 2025 18:59
rodrigok pushed a commit that referenced this pull request Oct 30, 2025
…37318)

Co-authored-by: Pierre Lehnen <55164754+pierre-lehnen-rc@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants