fix: slot start times with interrupted availabilities (#10164)
Co-authored-by: CarinaWolli <wollencarina@gmail.com>pull/10169/head
parent
7953551189
commit
5ff8d2db6e
|
@ -166,19 +166,6 @@ function buildSlotsWithDateRanges({
|
|||
|
||||
let slotStartTime = range.start.isAfter(startTimeWithMinNotice) ? range.start : startTimeWithMinNotice;
|
||||
|
||||
let previousStartTime;
|
||||
// check if we we already have slots on that day (in organizer's timezone)
|
||||
if (
|
||||
slots.length &&
|
||||
dayjs
|
||||
.utc(range.start)
|
||||
.add(range.start.utcOffset())
|
||||
.isSame(dayjs.utc(slots[slots.length - 1].time).add(slots[slots.length - 1].time.utcOffset()), "day")
|
||||
) {
|
||||
previousStartTime = slots[slots.length - 1].time;
|
||||
}
|
||||
|
||||
if (!previousStartTime) {
|
||||
let interval = 15;
|
||||
|
||||
const intervalsWithDefinedStartTimes = [60, 30, 20, 10];
|
||||
|
@ -192,15 +179,8 @@ function buildSlotsWithDateRanges({
|
|||
|
||||
slotStartTime =
|
||||
slotStartTime.utc().minute() % interval !== 0
|
||||
? slotStartTime
|
||||
.startOf("hour")
|
||||
.add(Math.ceil(slotStartTime.minute() / interval) * interval, "minute")
|
||||
? slotStartTime.startOf("hour").add(Math.ceil(slotStartTime.minute() / interval) * interval, "minute")
|
||||
: slotStartTime;
|
||||
} else {
|
||||
const minuteOffset =
|
||||
Math.ceil(slotStartTime.diff(previousStartTime, "minutes") / frequency) * frequency;
|
||||
slotStartTime = previousStartTime.add(minuteOffset, "minutes");
|
||||
}
|
||||
|
||||
// Adding 1 minute to date ranges that end at midnight to ensure that the last slot is included
|
||||
const rangeEnd = range.end
|
||||
|
|
Loading…
Reference in New Issue