palantir/blueprint

DateRangeInput2 TimePicker does not appear to respect minimum datetime

Open

#5859 opened on Jan 20, 2023

View on GitHub
 (0 comments) (0 reactions) (0 assignees)TypeScript (20,263 stars) (2,167 forks)batch import
P2Package: datetimeType: bughelp wanted

Description

Environment

  • Package version(s): v4.14.2
  • Operating System: macOS Ventura
  • Browser name and version: Chrome v109.0.5414.87

Code Sandbox

https://codesandbox.io/s/daterangeinput2-example-iwv0ln?file=/src/DateRangeInput2Example.tsx

Steps to reproduce

  1. On DateRangeInput2, set minDate and time picker minTime values to equal current time.
  2. Select a date range in the popover
  3. Observe that the min date and time is respected in the popover while the minTime value is ignored in the subsequent value produced by the onChange handler if the time value is not changed.

https://user-images.githubusercontent.com/2968519/213801179-0ecaa359-8ead-47eb-929c-4216bb0457d2.mp4

Actual behavior

When selecting a date range, the time always defaults to 12:00AM of the selected day which is often out of range if the minimum date time is set to the current time.

Expected behavior

I expected both the date and time to respect the minDate property since it is provided as a Date (which includes time). This would be helpful, for example, to constrain the range selection to both a minimum day and specific time (e.g. "Jan 20th after 12:00PM)

Possible solution

Contributor guide