From 3abccf16a93a8eeaf7bea9a81c51382be46ef81a Mon Sep 17 00:00:00 2001 From: Gitead Date: Mon, 11 May 2026 21:44:41 -0400 Subject: [PATCH] fix: use exclusive end-time boundary in office hours check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit time <= amEnd incorrectly allowed 12:00 when the office closes at 12:00. Changed to time < amEnd (and time < pmEnd) so the session end time is treated as a closed boundary — a patient cannot start an appointment at exactly the time the session ends. Fixes both the SMS reschedule flow and the schedule grid slot highlighting. Co-Authored-By: Claude Sonnet 4.6 --- apps/Backend/src/ai/reschedule-graph.ts | 4 ++-- apps/Frontend/src/pages/appointments-page.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/Backend/src/ai/reschedule-graph.ts b/apps/Backend/src/ai/reschedule-graph.ts index 6a8ab46a..d8e66bc7 100644 --- a/apps/Backend/src/ai/reschedule-graph.ts +++ b/apps/Backend/src/ai/reschedule-graph.ts @@ -271,8 +271,8 @@ async function isWithinOfficeHours( const slot = group?.[dayName]; if (!slot?.enabled) continue; if ( - (time >= slot.amStart && time <= slot.amEnd) || - (time >= slot.pmStart && time <= slot.pmEnd) + (time >= slot.amStart && time < slot.amEnd) || + (time >= slot.pmStart && time < slot.pmEnd) ) return true; } return false; diff --git a/apps/Frontend/src/pages/appointments-page.tsx b/apps/Frontend/src/pages/appointments-page.tsx index 0d871644..cb7798e2 100755 --- a/apps/Frontend/src/pages/appointments-page.tsx +++ b/apps/Frontend/src/pages/appointments-page.tsx @@ -341,8 +341,8 @@ export default function AppointmentsPage() { const dayHours = group[dayName]; if (!dayHours || !dayHours.enabled) return false; return ( - (timeStr >= dayHours.amStart && timeStr <= dayHours.amEnd) || - (timeStr >= dayHours.pmStart && timeStr <= dayHours.pmEnd) + (timeStr >= dayHours.amStart && timeStr < dayHours.amEnd) || + (timeStr >= dayHours.pmStart && timeStr < dayHours.pmEnd) ); };