eui icon indicating copy to clipboard operation
eui copied to clipboard

[EuiSuperDatePicker] Allow only certain range of dates

Open vvvprabhakar opened this issue 2 years ago • 6 comments

In EuiSuperDatePicker, there is no option to allow user to select certain range of dates

for example, if I want to select date range of the last seven days only? How will i do it

vvvprabhakar avatar Jul 04 '22 07:07 vvvprabhakar

This is not supported currently.

For the Absolute panel, it should be a straight forward add as we can forward minDate & maxDate values to the underlying datepicker control.

Gets trickier with Relative options, we have an error state for invalid inputs (e.g. negative numbers) and could do something similar if the selected relative range is invalid. This leads to the question of what an invalid relative range is: does the entire range need to fall in the date range or is only an overlap okay.

Similar question with the Now tab, should it go away if the present datetime is excluded, add a message & disable the Set button, or something else?

Perhaps I'm over complicating this, and only the modification to Absolute is necessary as it could be a UX-addictive thing that exists more to help guide a user than anything else. If so, we could allow a pass-through prop targeting the absolute tab's EuiDatePicker.

chandlerprall avatar Jul 05 '22 18:07 chandlerprall

@vvvprabhakar is the ability to control the selectable dates in the Absolute tab enough, or would you require the other date selection tabs to interact with the limited range?

chandlerprall avatar Jul 07 '22 16:07 chandlerprall

What I am thinking is, If users need to be restricted to select for only some 'X' days, If we have a property like minDate and maxDate it would be super helpful

This would be very helpful in kibana/opensearchDashboard time filter on the discover page

Where if we are able to make that time range configurable via config options and SuperDatePicker take that range

vvvprabhakar avatar Jul 10 '22 18:07 vvvprabhakar

if you want i will come up with a PR

vvvprabhakar avatar Jul 10 '22 18:07 vvvprabhakar

As we implemented invalid date, the same way we can also implement the raneg

vvvprabhakar avatar Jul 10 '22 18:07 vvvprabhakar

Adding minDate / maxDate at the top level API for EuiSuperDatePicker, using them in the Absolute panel, and adding validation in isRangeInvalid sounds like a good approach.

if you want i will come up with a PR

Please do! If you want any help or pointers feel free to ask, that code is bit of a web.

chandlerprall avatar Jul 20 '22 18:07 chandlerprall

👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment.

github-actions[bot] avatar Jan 17 '23 00:01 github-actions[bot]

❌ We're automatically closing this issue due to lack of activity. Please comment if you feel this was done in error.

github-actions[bot] avatar Jan 24 '23 08:01 github-actions[bot]