Fix for slots being duplicated in teams (#3082)

pull/2987/head^2
Alex van Andel 2022-06-16 17:03:51 +01:00 committed by GitHub
parent abe090881a
commit c5a40f6c37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 1 deletions

View File

@ -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;