components
components copied to clipboard
[Feature Request]: Limit time unit choices in Date Range Picker
Description
We are using the cloudscape date range picker with a relative range value. When users are selecting a custom range they have the following under selection of time "seconds", "minutes", "hours", "weeks", "months", "years". We would like to limit the selection to exclude possibly seconds and years? is this possible? I didn't see anything in the documentation about limiting what is available under the selection of time
. Below is the link to the component page.
https://cloudscape.design/components/date-range-picker/?tabId=playground&example=with-relative-range-value
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
- [X] I checked the current issues for duplicate requests
This is something that we deliberately didn't make configurable, as it would still be possible to input e.g. 24 months even if the 'year' option was removed - we would recommend making any constraints here via validation rather than configuration.
It makes sense that validation is still needed. However, I would suggest that there is still value in being able to limit down to sensible choices for users. We can look at the AWS X-Ray console as an example where this would be helpful. The maximum time range when querying is 6 hours. The presets they have all cover that, but it's still possible to select days/weeks/months as options. It's especially annoying because the validation only happens after the user fills in the time and hits apply. They're able to go through multiple clicks and keystrokes before the range limitation is surfaced.
I recognize that their console isn't using the current version of Cloudscape, but the problem is the same.
I agree that validation is crucial and plays a vital role, but it shouldn't be our only line of defense against user errors. Following UX best practices, preventing errors from occurring in the first place often leads to a smoother and more intuitive user experience.
To highlight a specific scenario for our use case: If a user selects a duration in 'months', and they choose 1 month, we're good to go. But, if they opt for 'years' and input any duration, it will always be incorrect given our constraints. Just like bilalq's example with AWS X-Ray, allowing users to pick an option that will inevitably result in an error can be frustrating. Instead of knowingly letting them proceed with an invalid choice and then redirecting them, why not streamline the process and narrow down their choices upfront?