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.

Comments

geoffreyr created an issue. See original summary.

geoffreyr’s picture

Title: Allow days of week and arbitrary dates to be excluded » Date field: Allow days of week and arbitrary dates to be excluded

Status: Needs review » Needs work

The last submitted patch, webform--exclude-dates.patch, failed testing.

geoffreyr’s picture

Status: Needs work » Needs review
StatusFileSize
new12.9 KB

Rerolled against latest dev.

Status: Needs review » Needs work

The last submitted patch, 4: webform--exclude-dates--4.patch, failed testing.

liam morland’s picture

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.

If there is refactoring to be done, that should be a separate ticket that is completed first.

liam morland’s picture

Status: Needs work » Closed (outdated)

Drupal 7 is no longer supported. If this applies to a supported version, please re-open.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.