Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

feat(patients): max DOB set for current date #1985

Closed
wants to merge 10 commits into from
14 changes: 13 additions & 1 deletion src/components/input/DatePickerWithLabelFormGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,21 @@ interface Props {
isRequired?: boolean
feedback?: string
isInvalid?: boolean
maxDate?: Date
}

const DatePickerWithLabelFormGroup = (props: Props) => {
const { onChange, label, name, isEditable, value, isRequired, feedback, isInvalid } = props
const {
onChange,
label,
name,
isEditable,
value,
isRequired,
feedback,
isInvalid,
maxDate,
} = props
const id = `${name}DatePicker`
return (
<div className="form-group">
Expand All @@ -22,6 +33,7 @@ const DatePickerWithLabelFormGroup = (props: Props) => {
dateFormat="MM/dd/yyyy"
dateFormatCalendar="LLLL yyyy"
dropdownMode="scroll"
maxDate={maxDate}
selected={value}
timeIntervals={30}
withPortal={false}
Expand Down
1 change: 1 addition & 0 deletions src/patients/GeneralInformation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ const GeneralInformation = (props: Props) => {
: undefined
}
isInvalid={invalidFields?.dateOfBirth}
maxDate={new Date()}
feedback={feedbackFields?.dateOfBirth}
onChange={(date: Date) => {
onDateOfBirthChange(date)
Expand Down