Skip to content

Scheduling infrastructure for absolutely everyone.

Fix for slots being duplicated in teams (#3082)

Alex van Andelc5a40f6c37f7
diff --git a/apps/web/lib/slots.ts b/apps/web/lib/slots.ts
index f7011edf47b..758b2823dae 100644
--- a/apps/web/lib/slots.ts
+++ b/apps/web/lib/slots.ts
@@ -100,7 +100,15 @@ const getSlots = ({ inviteeDate, frequency, minimumBookingNotice, workingHours,
slots.push(slot);
}
});
- return slots;
+
+ const uniq = (a: Dayjs[]) => {
+ const seen: Record<string, boolean> = {};
+ return a.filter((item) => {
+ return seen.hasOwnProperty(item.format()) ? false : (seen[item.format()] = true);
+ });
+ };
+
+ return uniq(slots);
};
export default getSlots;