mirror of
https://dev.azure.com/globalhealthx/EMR/_git/helix-engage
synced 2026-05-18 20:08:19 +00:00
fix(dates): block past-date selection in appointment + clinic holiday pickers
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
Bug 556 triggered a broader audit of every date input in the app: - appointment-form DatePicker now has minValue=today(getLocalTimeZone()) — can't book or reschedule into the past (tightens bug 555 at the input layer too; the past-slot filter in masterdata service still handles the hour-granularity) - clinic-form holiday date picker gets the same — can't observe a holiday that already passed Audit complete: - enquiry-form follow-up date: already had min=today (bug 556 fix) - appointment-form: fixed here - clinic-form holidays: fixed here - my-performance date filter: past valid (reports over history) - campaign-edit start/end: past valid (historical campaigns)
This commit is contained in:
@@ -6,7 +6,7 @@ import { Select } from '@/components/base/select/select';
|
||||
import { TextArea } from '@/components/base/textarea/textarea';
|
||||
import { Button } from '@/components/base/buttons/button';
|
||||
import { DatePicker } from '@/components/application/date-picker/date-picker';
|
||||
import { parseDate } from '@internationalized/date';
|
||||
import { parseDate, today, getLocalTimeZone } from '@internationalized/date';
|
||||
import { apiClient } from '@/lib/api-client';
|
||||
import { cx } from '@/utils/cx';
|
||||
import { notify } from '@/lib/toast';
|
||||
@@ -586,6 +586,11 @@ export const AppointmentForm = ({
|
||||
onChange={(val) => setDate(val ? val.toString() : '')}
|
||||
granularity="day"
|
||||
isDisabled={readOnly || !doctor}
|
||||
// Block past dates — appointments can't be booked or
|
||||
// rescheduled into the past. React Aria's DatePicker
|
||||
// honours minValue in both the calendar grid and the
|
||||
// typed-input fallback.
|
||||
minValue={today(getLocalTimeZone())}
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -399,6 +399,9 @@ export const ClinicForm = ({ value, onChange }: ClinicFormProps) => {
|
||||
onChange={(dv: DateValue | null) =>
|
||||
updateHoliday(idx, { date: dv ? dv.toString() : '' })
|
||||
}
|
||||
// Holidays must be today or in the future — you
|
||||
// can't observe a holiday that already passed.
|
||||
minValue={today(getLocalTimeZone())}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
|
||||
Reference in New Issue
Block a user