Merge pull request #180 from parasg1999/feature/overlappingAppointment

fix: check for overlapping appointments
This commit is contained in:
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

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);
}
});
}