palantir / blueprint

A React-based UI toolkit for the web
https://blueprintjs.com/
Apache License 2.0
20.53k stars 2.15k forks source link

Date Range Input: Time is not updating onHoverChange event #4402

Open RaghulXander opened 3 years ago

RaghulXander commented 3 years ago

Environment

Code Sandbox

Actually the bug can be visible in the documentation itself so adding Screenshot of it here

Screenshot 2020-11-08 at 11 57 08 AM

Steps to reproduce

Enable Time Precision with minute or seconds

  1. Click Start Date Field (so Date Picker opens).
  2. Select preferred date for both start and end fields.
  3. Please Add time in the below boxes for hours, minutes, seconds.
  4. Now Hover the different date in Date Picker and you can see start date in input field changes as per the hover state but the time value will be the default time itself (12:00)
  5. The same happens in end date field too.

Actual behavior

As we can clearly see the time is not changing and stays still with 12:00 during hovering of dates

Expected behavior

We should get the time from the value and update the time too when we hover Defaulting to 12:00 and changing immediately back to user selected time causes confusion

Possible solution

DateRangePicker props and callback function should be updated with props time i guess

adidahiya commented 3 years ago

Related: https://github.com/palantir/blueprint/issues/2625, https://github.com/palantir/blueprint/issues/3509

olegshilov commented 3 years ago

Hello @adidahiya. I found a small bug and I think it related to this issue. In DateRangeInput, when you change the time inside text input directly, time not changed at TimePicker at all. I think it's because DateRange at shouldComponentUpdate here checks only day equality as I see here here.

I can create a new issue if it's not related.

UPD As a solution a suggest adding a new argument precision to areRangesEqual method, which will allow us to use it for more correct date range validation.