DateRangeInput3: Shortcuts Return Incorrect Ranges for Single-Day Periods #7205
Open
Description
Environment
- Package version(s):
@blueprintjs/datetime2@2.3.21
- Browser name and version:
Chrome 132.0.6834.111
Code Sandbox
Minimal repro: CodeSandbox Example
This also occurs in the docs example for DateRangeInput3
Steps to Reproduce
- Use a
<DateRangeInput3>
or<DateRangePicker3>
component withallowSingleDayRange={true}
andtimePrecision
set (e.g.,timePrecision={TimePrecision.MINUTE}
). - Open the date picker to display the shortcuts menu.
- Select a shortcut that spans a single day, such as "Today" or "Yesterday."
- Observe that the start and end ranges are the same value, resulting in an invalid time range (e.g.,
"January 30th, 2025 at 12:00:00 AM"
to"January 30th, 2025 at 12:00:00 AM"
).
Expected Behavior
The date range picker should account for ranges that span only a single day.
For example, the expected range should be: "January 30th, 2025 at 12:00:00 AM"
to "January 30th, 2025 at 11:59:59 PM"
.
Actual Behavior
The start and end ranges are identical, causing issues when selecting shortcuts like "Yesterday" and "Today."
Possible Solution
Adjust the end time to be the very end of the day when selecting shortcuts or ranges that span only a single day. This adjustment could depend on whether timePrecision
is set.