palantir/blueprint

DateRangeInput2 TimePicker does not appear to respect minimum datetime

Open

#5,859 创建于 2023年1月20日

在 GitHub 查看
 (0 评论) (0 反应) (0 负责人)TypeScript (20,263 star) (2,167 fork)batch import
P2Package: datetimeType: bughelp wanted

描述

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

贡献者指南