Skip to content

Commit d8ddb46

Browse files
fix: slots in email embed sorted (calcom#25676)
* fix: slots in email embed sorted * fix: removed mutating of original array * fix: incorrect access of sortedTimes --------- Co-authored-by: Dhairyashil Shinde <93669429+dhairyashiil@users.noreply.github.com>
1 parent 6e5b812 commit d8ddb46

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

packages/features/embed/Embed.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,8 @@ const EmailEmbedPreview = ({
539539
Object.keys(selectedDateAndTime)
540540
.sort()
541541
.map((key) => {
542-
const firstSlotOfSelectedDay = selectedDateAndTime[key][0];
542+
const sortedTimes = [...selectedDateAndTime[key]].sort();
543+
const firstSlotOfSelectedDay = sortedTimes[0];
543544
const selectedDate = dayjs(firstSlotOfSelectedDay)
544545
.tz(timezone)
545546
.format("dddd, MMMM D, YYYY");
@@ -573,8 +574,8 @@ const EmailEmbedPreview = ({
573574
<table style={{ borderCollapse: "separate", borderSpacing: "0px 4px" }}>
574575
<tbody>
575576
<tr style={{ height: "25px" }}>
576-
{selectedDateAndTime[key]?.length > 0 &&
577-
selectedDateAndTime[key].map((time) => {
577+
{sortedTimes?.length > 0 &&
578+
sortedTimes.map((time) => {
578579
// If teamId is present on eventType and is not null, it means it is a team event.
579580
// So we add 'team/' to the url.
580581
const bookingURL = `${eventType.bookerUrl}/${

0 commit comments

Comments
 (0)