Is the `format` prop not working?
kayx23 opened this issue · 1 comments
kayx23 commented
Was expecting yyyy-mm-dd
format for the returned start and end dates from setting format
prop
<DateRangePicker onChange={setDate} value={date} format="y-MM-dd"/>
Ended up getting the default Date object format, just as without the prop, like Thu Nov 25 2021 17:51:55 GMT-0500 (Eastern Standard Time)
Not a big deal since I can convert it to string and parse the date out (e.g. setStartDate(date[0].toISOString().split('T')[0])
), but wondering if I'm misunderstanding the usage? Thanks
wojtekmaj commented
There has been a misunderstanding indeed. format
prop handles how inputs are displayed in the picker itself, but onChange always returns Date. I suggest date-fns for formatting Date.