i am using the react datepicker module and in that i am using it only for month and year picker. when i get the date in my onChange in react date picker. i get ‘Mon Nov 01 2021 00:00:00 GMT+0400 (Gulf Standard Time)’ and in my redux store i get 2021-10-31T20:00:00.000Z
. there is a four hours lap due to which i get the error date.format is not a function
and in some cases i get invalid time format error as well. so please if anybody knows let me know.
my code for date picker is below
`
<DatePicker
selected={passenger?.passportExp}
onChange={date => {
modifyPassenger(index, { passportExp: date }) }
}
maxDate={newDate(new Date().getFullYear(),new Date().getMonth()+1, 0)}
showMonthYearPicker
dateFormat="MMM yyyy" onFocusChange={({focused }) => this.setState({ passportExp: focused })} />
`