Skip to content

DateRangeInput3: Shortcuts Return Incorrect Ranges for Single-Day Periods #7205

Open
@ggdouglas

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

Image

Steps to Reproduce

  1. Use a <DateRangeInput3> or <DateRangePicker3> component with allowSingleDayRange={true} and timePrecision set (e.g., timePrecision={TimePrecision.MINUTE}).
  2. Open the date picker to display the shortcuts menu.
  3. Select a shortcut that spans a single day, such as "Today" or "Yesterday."
  4. 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.

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions