Created
November 24, 2014 01:38
-
-
Save reediredale/7e8f1f7ebf2ee61611cb to your computer and use it in GitHub Desktop.
Gravity Forms Datepicker No Weekends
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
<script> | |
jQuery(document).bind('gform_post_render', function(){ | |
// destroy default Gravity Form datepicker | |
jQuery("#input_2_3").datepicker('destroy'); | |
// create new custom datepicker | |
var oneWorkingDays = new Date(); | |
var adjustments = [0, 1, 1, 1, 1, 1, 0]; // Offsets by day of the week | |
oneWorkingDays.setDate(oneWorkingDays.getDate() + 1 + adjustments[oneWorkingDays.getDay()]); | |
jQuery("#input_2_3").datepicker({ beforeShowDay: jQuery.datepicker.noWeekends, minDate: '+1d', gotoCurrent: true, prevText: '', showOn: 'both', buttonImage: '/wp-content/plugins/gravityforms/images/calendar.png', buttonImageOnly: true }); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment