Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ggdouglas opened this issue Jan 30, 2025 · 0 comments
Open

Comments

@ggdouglas
Copy link
Contributor

Environment

  • Package version(s): @blueprintjs/[email protected]
  • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants