Make sure the slots equal the month and date of the invitee so we can check isSame with freebusy
This commit is contained in:
parent
9fe11ea10d
commit
bfc7cce688
2 changed files with 8 additions and 4 deletions
|
@ -54,12 +54,11 @@ const Slots = ({ eventLength, minimumBookingNotice, date, workingHours, organize
|
||||||
|
|
||||||
// Check for conflicts
|
// Check for conflicts
|
||||||
for (let i = times.length - 1; i >= 0; i -= 1) {
|
for (let i = times.length - 1; i >= 0; i -= 1) {
|
||||||
busyTimes.forEach((busyTime) => {
|
busyTimes.every((busyTime): boolean => {
|
||||||
const startTime = dayjs(busyTime.start).utc();
|
const startTime = dayjs(busyTime.start).utc();
|
||||||
const endTime = dayjs(busyTime.end).utc();
|
const endTime = dayjs(busyTime.end).utc();
|
||||||
|
|
||||||
// Check if start times are the same
|
// Check if start times are the same
|
||||||
if (times[i].utc().format("HH:mm") == startTime.format("HH:mm")) {
|
if (times[i].utc().isSame(startTime)) {
|
||||||
times.splice(i, 1);
|
times.splice(i, 1);
|
||||||
}
|
}
|
||||||
// Check if time is between start and end times
|
// Check if time is between start and end times
|
||||||
|
@ -73,7 +72,10 @@ const Slots = ({ eventLength, minimumBookingNotice, date, workingHours, organize
|
||||||
// Check if startTime is between slot
|
// Check if startTime is between slot
|
||||||
else if (startTime.isBetween(times[i].utc(), times[i].utc().add(eventLength, "minutes"))) {
|
else if (startTime.isBetween(times[i].utc(), times[i].utc().add(eventLength, "minutes"))) {
|
||||||
times.splice(i, 1);
|
times.splice(i, 1);
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,9 @@ const getSlots = ({
|
||||||
organizerBoundaries(workingHours, inviteeDate, inviteeBounds, organizerTimeZone)
|
organizerBoundaries(workingHours, inviteeDate, inviteeBounds, organizerTimeZone)
|
||||||
)
|
)
|
||||||
.reduce((slots, boundary: Boundary) => [...slots, ...getSlotsBetweenBoundary(frequency, boundary)], [])
|
.reduce((slots, boundary: Boundary) => [...slots, ...getSlotsBetweenBoundary(frequency, boundary)], [])
|
||||||
.map((slot) => slot.utcOffset(dayjs(inviteeDate).utcOffset()));
|
.map((slot) =>
|
||||||
|
slot.month(inviteeDate.month()).date(inviteeDate.date()).utcOffset(inviteeDate.utcOffset())
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default getSlots;
|
export default getSlots;
|
||||||
|
|
Loading…
Reference in a new issue