react-multi-date-picker icon indicating copy to clipboard operation
react-multi-date-picker copied to clipboard

onChange not working when using handleChange Formik

Open erfantmi9 opened this issue 3 years ago • 5 comments

I really like your package but when I put the handleChange from Formik into the onChange property of datepicker , it won't do anything right.

erfantmi9 avatar Dec 27 '21 10:12 erfantmi9

+1 returning wrong dates

wafaa-ismail avatar Dec 27 '21 16:12 wafaa-ismail

@wafaa-ismail sorry I didn't get it. please explain to me

erfantmi9 avatar Dec 28 '21 11:12 erfantmi9

onchange returns DateObject, not javascript Date. log the returning event somewhere, you will get the point.

M-Kia avatar Apr 12 '22 18:04 M-Kia

As a workaround you can pass a callback which will support handleChange (handleChange expects a Change Event) For eg. onChange={ (newDate) => ({ target: { name: "inputName", value: newDate.toDate(), // Converting DateObject to JS Date } }) }

jamsfy-cyrus avatar Jun 19 '22 11:06 jamsfy-cyrus

image this way fix my problem

Tahmasb avatar Jan 16 '23 06:01 Tahmasb