I have a need using Elm-DatePicker for more complex logic on which dates are disabled. In this particular case I need to limit enabled dates to weekdays in the future and just how far in the future depends on the current time of day.
I considered an extension to Elm-DateTime that might allow mixing rule sets such as DateLimit { minDate, maxDate }
along with something like WeekdayLimit (List Time.Weekday), but my requirement depending on the current time of day makes a more declarative style difficult at best to specify cleanly. I believe it is also common in calendar widgets to allow a custom function for providing valid date rules.
This PR is a proof of concept of how to add a custom validator function controlling which dates are disabled. If the overall approach is acceptable it would still need to be ported to DateRangePicker as well as documents and comments updated.
I have a need using Elm-DatePicker for more complex logic on which dates are disabled. In this particular case I need to limit enabled dates to weekdays in the future and just how far in the future depends on the current time of day.
I considered an extension to Elm-DateTime that might allow mixing rule sets such as
DateLimit { minDate, maxDate }
along with something likeWeekdayLimit (List Time.Weekday)
, but my requirement depending on the current time of day makes a more declarative style difficult at best to specify cleanly. I believe it is also common in calendar widgets to allow a custom function for providing valid date rules.This PR is a proof of concept of how to add a custom validator function controlling which dates are disabled. If the overall approach is acceptable it would still need to be ported to
DateRangePicker
as well as documents and comments updated.