Fix user time format not respected and booking dates not localized on emails (#7682)
* Localized booking date * re add space * Add locale per format call due to lambda dayjs instance share between users --------- Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
1 parent
1c8f9cb3fd
commit
18414e857a
5 files changed
+13
-5
No files matched your search
@@ -1,8 +1,9 @@
|
||||
import { TFunction } from "next-i18next";
|
||||
import type { TFunction } from "next-i18next";
|
||||
import { RRule } from "rrule";
|
||||
|
||||
import dayjs from "@calcom/dayjs";
|
||||
import { getEveryFreqFor } from "@calcom/lib/recurringStrings";
|
||||
import { TimeFormat } from "@calcom/lib/timeFormat";
|
||||
import type { CalendarEvent, Person } from "@calcom/types/Calendar";
|
||||
import type { RecurringEvent } from "@calcom/types/Calendar";
|
||||
|
||||
@@ -30,13 +31,15 @@ export function getRecurringWhen({
|
||||
|
||||
export function WhenInfo(props: { calEvent: CalendarEvent; timeZone: string; t: TFunction }) {
|
||||
const { timeZone, t, calEvent: { recurringEvent } = {} } = props;
|
||||
const timeFormat = props.calEvent.organizer.timeFormat || TimeFormat.TWELVE_HOUR;
|
||||
const locale = props.calEvent.organizer.language.locale;
|
||||
|
||||
function getRecipientStart(format: string) {
|
||||
return dayjs(props.calEvent.startTime).tz(timeZone).format(format);
|
||||
return dayjs(props.calEvent.startTime).tz(timeZone).locale(locale).format(format);
|
||||
}
|
||||
|
||||
function getRecipientEnd(format: string) {
|
||||
return dayjs(props.calEvent.endTime).tz(timeZone).format(format);
|
||||
return dayjs(props.calEvent.endTime).tz(timeZone).locale(locale).format(format);
|
||||
}
|
||||
|
||||
const recurringInfo = getRecurringWhen({
|
||||
@@ -54,8 +57,7 @@ export function WhenInfo(props: { calEvent: CalendarEvent; timeZone: string; t:
|
||||
description={
|
||||
<>
|
||||
{recurringEvent?.count ? `${t("starting")} ` : ""}
|
||||
{t(getRecipientStart("dddd").toLowerCase())}, {t(getRecipientStart("MMMM").toLowerCase())}{" "}
|
||||
{getRecipientStart("D, YYYY | h:mma")} - {getRecipientEnd("h:mma")}{" "}
|
||||
{getRecipientStart(`dddd, LL | ${timeFormat}`)} - {getRecipientEnd(timeFormat)}{" "}
|
||||
<span style={{ color: "#4B5563" }}>({timeZone})</span>
|
||||
</>
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user