fix(emails): preserve 24h format in attendee confirmation emails#28494
Open
abdulbaqui17 wants to merge 1 commit intocalcom:mainfrom
Open
fix(emails): preserve 24h format in attendee confirmation emails#28494abdulbaqui17 wants to merge 1 commit intocalcom:mainfrom
abdulbaqui17 wants to merge 1 commit intocalcom:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes attendee (booker) confirmation emails rendering times in 12-hour format when the booking/host uses 24-hour format, by ensuring the attendee payload passed to the email template includes a proper timeFormat fallback.
Changes:
- Add a fallback in
AttendeeScheduledEmail.getHtmlto usecalEvent.organizer.timeFormatwhenattendee.timeFormatis missing. - Add a regression test asserting the attendee render payload receives
TWENTY_FOUR_HOURwhen the organizer uses 24-hour format and attendee time format is absent.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/emails/templates/attendee-scheduled-email.ts | Ensures attendee template props include a timeFormat fallback to organizer preference. |
| packages/emails/email-manager.test.ts | Adds a regression test to validate the time format fallback behavior in the render payload. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import { TimeFormat } from "@calcom/lib/timeFormat"; | ||
| import type { CalendarEvent, Person } from "@calcom/types/Calendar"; | ||
|
|
||
| import { shouldSkipAttendeeEmailWithSettings, fetchOrganizationEmailSettings } from "./email-manager"; |
Comment on lines
+412
to
+421
| describe("AttendeeScheduledEmail - Time format fallback", () => { | ||
| const createMockPerson = (name: string, email: string): Person => ({ | ||
| name, | ||
| email, | ||
| timeZone: "America/New_York", | ||
| language: { | ||
| translate: vi.fn((key: string) => key), | ||
| locale: "en", | ||
| }, | ||
| }); |
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes attendee (scheduler/booker) confirmation emails showing 12-hour time when the booking was made in 24-hour format.
Root Cause
Attendee scheduled emails rely on
attendee.timeFormat, but in this flow it can be missing. The template then falls back to 12-hour format by default.Fix
attendee.timeFormatis missing, fallback tocalEvent.organizer.timeFormat.Tests
timeFormatwhen attendee time format is absent and organizer uses 24-hour format.TZ=UTC yarn vitest run packages/emails/email-manager.test.tsScope
Closes #28472