Skip to content
Snippets Groups Projects
Commit 4f127a63 authored by lass's avatar lass
Browse files

Make end-date a required field in stepPersonForm

parent 864f899f
No related branches found
No related tags found
1 merge request!396Greg 334 fix
...@@ -320,13 +320,14 @@ const StepPersonForm = forwardRef( ...@@ -320,13 +320,14 @@ const StepPersonForm = forwardRef(
<Controller <Controller
name="role_end" name="role_end"
control={control} control={control}
rules={{ required: true }}
render={({ field }) => ( render={({ field }) => (
<DatePicker <DatePicker
mask="____-__-__" mask="____-__-__"
label={t('input.roleEndDate')} label={t('input.roleEndDate')}
value={endDate}
minDate={today} minDate={today}
maxDate={todayPlusMaxDays} maxDate={todayPlusMaxDays}
value={endDate}
inputFormat="yyyy-MM-dd" inputFormat="yyyy-MM-dd"
onChange={(value) => { onChange={(value) => {
setEndDate(value) setEndDate(value)
...@@ -336,6 +337,11 @@ const StepPersonForm = forwardRef( ...@@ -336,6 +337,11 @@ const StepPersonForm = forwardRef(
/> />
)} )}
/> />
{!!errors.role_end && errors.role_end.type === 'required' && (
<Box sx={{ typography: 'caption', color: 'red' }}>
{t('validation.roleEndRequired')}
</Box>
)}
{displayContactAtUnit && ( {displayContactAtUnit && (
<TextField <TextField
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment