nextui-org / nextui

🚀 Beautiful, fast and modern React UI library.
https://nextui.org
MIT License
21.48k stars 1.4k forks source link

[Feature Request] An event handler when the user clicks on a date in DateRangePicker #3473

Open spilist opened 2 months ago

spilist commented 2 months ago

Is your feature request related to a problem? Please describe.

In DateRangePicker, I wanted to make it possible to select only up to 2 weeks before and after when a user clicks a date inside Calendar UI.

Describe the solution you'd like

When an event handler, say onDateSelected, is called when a user clicks a date inside Calendar, I can dynamically change maxValue and minValue props of DateRangePicker.

Describe alternatives you've considered

  1. Without adding a new handler, add a new possible option for maxValue as number. A positive number can be given to these props only when isMaxValueRelative prop is true. For example, if 30 is set to maxValue, DateRangePicker only permits date from the selected date to "30 days after the selected date". Same for minValue.
  2. (current alternative) Show error message when user selects more than 2 weeks of period.

Screenshots or Videos

No response

linear[bot] commented 2 months ago

ENG-1140 [Feature Request] An event handler when the user clicks on a date in DateRangePicker

awesome-pro commented 1 month ago

@spilist I think you can use Date-range-picker component for this purpose. You can use useState hook to set values as per user interaction. I believe it should solve your feature need.

Or developing this feature requires team permission I will confirm you soon