diff --git a/frontend/src/routes/sponsor/register/stepPersonForm.tsx b/frontend/src/routes/sponsor/register/stepPersonForm.tsx index 2a212fa3cebeb1e3782d8fadc32eb3cba0a8db40..40fcfaf690fe7cc9217a8ef3fc71ec538f1102d7 100644 --- a/frontend/src/routes/sponsor/register/stepPersonForm.tsx +++ b/frontend/src/routes/sponsor/register/stepPersonForm.tsx @@ -49,7 +49,6 @@ const StepPersonForm = forwardRef( const [todayPlusMaxDays, setTodayPlusMaxDays] = useState(today) const roleTypes = useRoleTypes() const { displayContactAtUnit, displayComment } = useContext(FeatureContext) - const [endDate, setEndDate] = useState<Date | null>(null) const roleTypeSort = () => (a: RoleTypeData, b: RoleTypeData) => { if (i18n.language === 'en') { @@ -104,9 +103,6 @@ const StepPersonForm = forwardRef( : roleTypes.find((rt) => rt.id === roleTypeId) const maxDate = getMaxDateForRoleType(selectedRoleTypeInfo) setTodayPlusMaxDays(maxDate) - // Trigger revalidation of role end since the max end date is - // different for different role types - trigger('role_end') } // When the component is first rendered and there is some role_type set in @@ -325,12 +321,11 @@ const StepPersonForm = forwardRef( <DatePicker mask="____-__-__" label={t('input.roleEndDate')} - value={endDate} + value={field.value} minDate={today} maxDate={todayPlusMaxDays} inputFormat="yyyy-MM-dd" onChange={(value) => { - setEndDate(value) field.onChange(value) }} renderInput={(params) => <TextField {...params} />}