I am using React date picker in a multistep form when I choose date and press continue back and then go to previous step I won't get date picker value I using redux and get data from redux , setValue using it. I am also use react hook form. Please guide me how can i get date picker value when I click on previous step?
<DatePicker
id="start_ds"
placeholderText="MMMM d, yyyy h:mm aa"
selected={startDates}
//value={startDates}
onChange={(date) => setStartDates(date ? date : "")}
showTimeSelect
minDate={new Date()} //set the current date to disable past
date
minTime={new Date().getTime()} //set current time to disable past time
maxTime={setHours(setMinutes(new Date(), 59), 23)} //this set the max time (i.e. 23:59)
dateFormat="MMMM d, yyyy h:mm aa"
required={true}
name="start_date"
autoComplete="off"
/>
const oldData = useSelector((props) => props.events);
if ($("#start_ds").val() === undefined) {
setValue("start_date", oldData.selectedDates.start_date);
}