design-system-react icon indicating copy to clipboard operation
design-system-react copied to clipboard

Inconsistent date output in Datepicker

Open interactivellama opened this issue 8 years ago • 2 comments

Today is today at current time.

screenshot 2017-01-20 15 20 13

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.

interactivellama avatar Jan 20 '17 22:01 interactivellama

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.

pradumangoyal avatar Mar 14 '19 23:03 pradumangoyal

@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.

interactivellama avatar Mar 28 '19 05:03 interactivellama