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

[feature proposal] "auto range" better UX for large ranges #4658

Open
mirus-ua opened this issue Apr 3, 2024 · 1 comment
Open

[feature proposal] "auto range" better UX for large ranges #4658

mirus-ua opened this issue Apr 3, 2024 · 1 comment

Comments

@mirus-ua
Copy link
Contributor

mirus-ua commented Apr 3, 2024

Is your feature request related to a problem? Please describe.
When you work with the range datepicker and your ranges are more than a month, the price of a mistake is high, so if you miss your endDate or startDate, you must redo everything from scratch. It means tedious scrolling back and forth through months to reselect the proper dates. I tried to visualize the pain in the video below.

2024-04-03.10.38.05.mov

Describe the solution you'd like
We may extend the Datepicker component with an optional prop autoRange (or suggest a better name for it) that will prevent nullifying the range but rather modify a start or an end date according to simple logic:

if (clickedDate < middleDateOfTheRange) {
  startDate = clickedDate
} else {
  endDate = clickedDate
}

I see only one drawback: the ability to reset the range in the default calendar.

Describe alternatives you've considered
I don't see other options for minimizing the cost of a mistake in the significant ranges.

Additional context
I started the conversation with an issue rather than a PR because the proposal is essential for our users, but still it's controversial. It doesn't have a happy path to solve the UX problem, so I prefer to discuss it with the community first. If we agree on the proposal, I'll implement it.

@mirus-ua
Copy link
Contributor Author

I've been thinking the optional prop can be named rangeStrategy and accept a union increase | decrease | both

  • increase means that we won't discard a range if the user picks a date "outside" the existing range
    for example, the user has 20/01/2024 - 20/02/2024 if they clicked 15/01/2024 means that we will change the startDate of the existing range and keep the endDate, the same works for endDate increasing. If we click inside the date range, the flow starts as usual from discarding the range.
  • decrease is the opposite of increase (thx, captain) we change a startDate and an endDate if a user clicks inside the range and discard if they clicked outside the range
  • both for cases when we will never discard the range but only adjust a startDate and an endDate according to the initial idea

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

No branches or pull requests

1 participant