Last active
September 21, 2015 02:36
-
-
Save vladimirlukyanov/e1118174638e0c021631 to your computer and use it in GitHub Desktop.
No weekends Gravity Forms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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