Merge pull request #180 from parasg1999/feature/overlappingAppointment

fix: check for overlapping appointments
pull/147/head
Bailey Pumfleet 2021-05-10 11:28:57 +01:00 committed by GitHub
commit 1ab1dfc669
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -144,6 +144,16 @@ export default function Type(props) {
if (dayjs(times[i]).isBetween(startTime, endTime)) {
times.splice(i, 1);
}
// Check if slot end time is between start and end time
if (dayjs(times[i]).add(props.eventType.length, 'minutes').isBetween(startTime, endTime)) {
times.splice(i, 1);
}
// Check if startTime is between slot
if(startTime.isBetween(dayjs(times[i]), dayjs(times[i]).add(props.eventType.length, 'minutes'))) {
times.splice(i, 1);
}
});
}