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:
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user