Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions src/abstract/lib/GroupBuilder/GroupUtility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,36 @@ export class GroupUtility {

public isInsideValidDatesInterval(event: ScheduleEvent) {
const { startDate, endDate } = event.availability;
const { timeFrom, timeTo } = event.availability;
Comment thread
adeiji marked this conversation as resolved.
Outdated

const now = this.getNow();

// Time must be added to start date and end date if they are defined, otherwise the interval will be invalid.
const from =
startDate && timeFrom
? new Date(
startDate.getFullYear(),
startDate.getMonth(),
startDate.getDate(),
timeFrom.hours,
timeFrom.minutes,
)
: (startDate ?? undefined);
const to =
endDate && timeTo
? new Date(
endDate.getFullYear(),
endDate.getMonth(),
endDate.getDate(),
timeTo.hours,
timeTo.minutes,
)
: (endDate ?? undefined);

return this.isInInterval(
{
from: startDate ?? undefined,
to: endDate ?? undefined,
from,
to,
},
now,
'both',
Expand Down
Loading