I'm creating a Drupal form with a datetime-based javascript popup calendar input that allows users to set a date for when they want to pick something up or drop it off. However, I can't find a way to limit what dates are selectable as input. For example, if we're only open Monday-Wednesday-Friday, I don't want people to be able to use the selector to indicate they want a pickup on Sunday.
I've looked far and low for calendar input validation and a usable blocking mechanism, but so far no luck.
Drupal uses the jQuery datepicker to pick dates. I haven't looked at how the Date module implements the js, but you can probably add extra options to it. Alternatively, you can just add the datepicker yourself. You can get what you want with the jQuery datepicker pretty easily:
$("#test").datepicker({
beforeShowDay: function(date) {
if (date.getDay() % 2 == 1 && date.getDay() < 6) {
return [true];
}
else {
return [false];
}
}
});
beforeShowDay is a function that is run for each day and should return a list where first item is a boolean that decides if you day is selectable. The second value is an optional class to add and there is a third that can be used as well, but can't remember what that is for right now.