I think this is similar to a few other issues in Webform, but I've implemented a patch that allows you to exclude dates on the basis of day of week, or specific individual dates. Validation is handled at submit time, and if a datepicker is used, it ensures excluded dates are disabled in the datepicker.
The UI for entering specific dates for exclusion is a bit rudimentary - it's a textarea that accepts any PHP-compatible date string on multiple lines - but it works reasonably well enough, and all dates are normalised before they are used for validation or rendered to the frontend.
I've also taken the liberty of cleaning up the webform calendar render element, but this might be a breaking change. Please shout out if you'd like me to reroll with a more backwards-compatible implementation.
I'm also not sure about that _webform_date_days_of_week
implementation; unfortunately, a better way to do so escaped me, and I couldn't think of another Drupal API function that provided the same thing.
Comment | File | Size | Author |
---|---|---|---|
#4 | webform--exclude-dates--4.patch | 12.9 KB | geoffreyr |
Comments
Comment #2
geoffreyr CreditAttribution: geoffreyr commentedComment #4
geoffreyr CreditAttribution: geoffreyr commentedRerolled against latest dev.
Comment #6
Liam MorlandIf there is refactoring to be done, that should be a separate ticket that is completed first.