svelte-plugins / datepicker

A simple datepicker component designed for Svelte.
https://svelte-plugins.github.io/datepicker
MIT License
54 stars 12 forks source link

✨ Ability to constrain min/max date range #36

Closed jtylr closed 1 week ago

jtylr commented 1 week ago

Is your feature request related to a problem? Please describe. I'm date selection feature where the user can select a range of available data. Currently we use <input type="date"> with min and max properties.

Describe the solution you'd like minDate and maxDate properties would be very helpful. Then when a user is picking a range, dates outside of the min/max would be disabled.

Describe alternatives you've considered I considered making an array of all available dates and feeding them into the enabledDates property. But when we're dealing with potential multi-year periods, loading in 700+ dates seemed a bit clunky.

jtylr commented 1 week ago

Turns out I missed this from the REPL link: enabledDates={["2023-02-01:2023-03-01"]}

Works perfectly, cheers for all the hard work!