Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
No weekends Gravity Forms
(function ($, root, undefined) {
$(function () {
'use strict';
// DOM ready, take it away
function noSundaysOrSaturdays(date) {
var weekday = new Array(7);
weekday[0] = "Sunday";
weekday[1] = "Monday";
weekday[2] = "Tuesday";
weekday[3] = "Wednesday";
weekday[4] = "Thursday";
weekday[5] = "Friday";
weekday[6] = "Saturday";
if (weekday[date.getDay()] == 'Sunday') {
return [false, '', 'Not open on Sundays'];
} else if (weekday[date.getDay()] == 'Saturday') {
return [false, '', 'Not open on Saturdays'];
}
return [true];
}
jQuery(window).load(function () {
jQuery('.hasDatepicker').datepicker('option', 'beforeShowDay', noSundaysOrSaturdays);
});
});
})(jQuery, this);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment