Open geertmulders opened 3 years ago
Greetings @geertmulders and thanks a lot for raising this issue.
I believe that the current behavior of the DateRangePicker
cannot accommodate single date selection because of a couple of reasons.
DateRangePicker
). For example if a user selects the 4th of August and then changes their mind, they would click on the 4th of August once more to cancel their range selection.DatePicker
component was created in order to accommodate single date selection. If we were to merge the functionality of the DateRangePicker
with the functionality of the DatePicker
we would've rendered the DatePicker
redundant. That may be a different way to implement a DatePicker
but unfortunately that's not they way we went because of having use cases for both implementations but also for reducing the code complexity of our components.Could your problem be solved by using two different types of filters / inputs ( one that spawns a DatePicker
for single date selection and another one that spawns a DateRangePicker
for date range selection ) or by using different pages / views ?
I have no idea over what your project / scope is but in my personal experience, its easier to show users more data when they are querying for a singe date rather than a date, so my intuition would be to create a view where it has a DatePicker
and shows more elaborate data and another one which uses a DateRangePicker
but shows more like an overview of the data and navigates the user to the view mentioned above when they would like more details.
I hope I've been of help but feel free to contact me should you require any help or have any issues that I can help with.
Panos
Thanks @PanagiotisGeorgiadis for your answer.
I don't think this can be solved using a combination of a date-picker and a range-picker. The requirements for my project is to show a list of "data-items" and to filter them by their creation date on a range of dates. If the user wants to select items for one single day it must be possible to select the same end- and start-date. I don't want to bother the user with different types of inputs. Besides this, semantically it is a truly different thing to select a single date or to select an empty range.
When selecting a date-range using the DateRangePicker it is impossible to select a range that starts and ends on the same date.
In our use case we want to view data on a specific range, where it makes perfect sense to view data only for one day.