I want to select a time range with react-datepicker,
and also use react-hook-form to validate when onBlur
without input
,
here is my code:
<Controller
control={control}
name='time'
rules={{ required: true }}
render={({
field: { value, onChange, onBlur }
}) => (
<Datepicker
dateFormat='yyyy/MM/dd h:mm aa'
onChange={onChange}
onBlur={onBlur}
selected={value}
showTimeSelect
/>
)}
/>
I can choose one date and time in one picker and do validation right now, it works, but if I want to choose two date and time in one picker, what should I do? How do I make react-hook-form identify the start or end time in picker? is it possible?