design-system-react
design-system-react copied to clipboard
Inconsistent date output in Datepicker
Today is today at current time.
Yesterday is yesterday at midnight.
Probably need to feed midnight into the new Date()
call or produce the date with the just days and not time. Or we need to switch everything to midnight on output.
I went through the code of DatePicker
and what I found is that we can't directly produce the date with the just days and not time as, parsed data is of type [object Date]
which by default includes time and we can't/shouldn't define our own string format to represent date so I think shifting to midnight
is the best option here. I have started working on a PR for this issue.
@futuremint What do you think about changing dates values (which always include time) in DatePicker to midnight of the user's timezone? Right now, it's inconsistent and is sometimes the current time and sometimes midnight and has been this way for 2+ years.
This will result in a breaking change, and I'm not sure if there is a good way to warn the user about it. One option is that we could rename the prop callback and keep the current inconsistency in the current set of props in case someone is working around this bug.