fix: use exclusive end-time boundary in office hours check

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 <noreply@anthropic.com>
This commit is contained in:
Gitead
2026-05-11 21:44:41 -04:00
parent 5e3cfef52b
commit 3abccf16a9
2 changed files with 4 additions and 4 deletions

View File

@@ -271,8 +271,8 @@ async function isWithinOfficeHours(
const slot = group?.[dayName]; const slot = group?.[dayName];
if (!slot?.enabled) continue; if (!slot?.enabled) continue;
if ( if (
(time >= slot.amStart && time <= slot.amEnd) || (time >= slot.amStart && time < slot.amEnd) ||
(time >= slot.pmStart && time <= slot.pmEnd) (time >= slot.pmStart && time < slot.pmEnd)
) return true; ) return true;
} }
return false; return false;

View File

@@ -341,8 +341,8 @@ export default function AppointmentsPage() {
const dayHours = group[dayName]; const dayHours = group[dayName];
if (!dayHours || !dayHours.enabled) return false; if (!dayHours || !dayHours.enabled) return false;
return ( return (
(timeStr >= dayHours.amStart && timeStr <= dayHours.amEnd) || (timeStr >= dayHours.amStart && timeStr < dayHours.amEnd) ||
(timeStr >= dayHours.pmStart && timeStr <= dayHours.pmEnd) (timeStr >= dayHours.pmStart && timeStr < dayHours.pmEnd)
); );
}; };