Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

O3-2461: Can't select earlier date on Appointments form #827

Merged
merged 1 commit into from
Oct 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const AppointmentForm: React.FC<AppointmentFormProps> = ({ appointment, patientU
const { defaultFacility, isLoading: loadingDefaultFacility } = useDefaultLoginLocation();

const appointmentService = services?.find(({ uuid }) => uuid === patientAppointment.serviceUuid);
const today = dayjs().startOf('day').toDate();

useEffect(() => {
if (locations?.length && sessionUser) {
Expand Down Expand Up @@ -217,7 +218,7 @@ const AppointmentForm: React.FC<AppointmentFormProps> = ({ appointment, patientU
dateFormat="d/m/Y"
datePickerType="single"
id="visitDate"
minDate={patientAppointment.visitDate}
minDate={today}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that I set the minDate to be "today", which seems reasnable for a POC scheduling functionality. I'm fine with removing any constraint if people think that is better to allow retrospectively entering/scheduling appointments after they already should have happened.

className={styles.datePickerInput}
onChange={([date]) => setPatientAppointment({ ...patientAppointment, visitDate: date })}
value={patientAppointment.visitDate}>
Expand Down
Loading