From 3da430b577bada2abd130f4d9763200af1fb5f1f Mon Sep 17 00:00:00 2001 From: Paras Gupta Date: Mon, 10 May 2021 02:28:05 +0530 Subject: [PATCH 1/2] fix: check for overlapping appointments --- pages/[user]/[type].tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pages/[user]/[type].tsx b/pages/[user]/[type].tsx index 6affe33040..3e06a2000e 100644 --- a/pages/[user]/[type].tsx +++ b/pages/[user]/[type].tsx @@ -144,6 +144,11 @@ 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); + } }); } From 977e879406e8080b1f29edea47e124484ac675f2 Mon Sep 17 00:00:00 2001 From: Paras Gupta Date: Mon, 10 May 2021 02:48:12 +0530 Subject: [PATCH 2/2] fix: busy time in slot interval --- pages/[user]/[type].tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pages/[user]/[type].tsx b/pages/[user]/[type].tsx index 3e06a2000e..38ca403a30 100644 --- a/pages/[user]/[type].tsx +++ b/pages/[user]/[type].tsx @@ -149,6 +149,11 @@ export default function Type(props) { 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); + } }); }