eui
eui copied to clipboard
[EuiSuperDatePicker] Allow only certain range of dates
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
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.
@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?
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
if you want i will come up with a PR
As we implemented invalid date, the same way we can also implement the raneg
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.
👋 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.
❌ We're automatically closing this issue due to lack of activity. Please comment if you feel this was done in error.