Skip to content

Instantly share code, notes, and snippets.

@brycejacobson
Created August 15, 2017 18:28
Show Gist options
  • Save brycejacobson/94183df9913fe5684c246db8e9154639 to your computer and use it in GitHub Desktop.
Save brycejacobson/94183df9913fe5684c246db8e9154639 to your computer and use it in GitHub Desktop.
Gravity Forms Restrict Date Picker Date Range
<script type="text/javascript">
// Add the following to an HTML block on your form
gform.addFilter( 'gform_datepicker_options_pre_init', function( optionsObj, formId, fieldId ) {
if ( formId == 7 && fieldId == 220, 226, 243, 282, 290, 298, 348, 356, 364, 414, 422, 430 ) {
optionsObj.minDate = '+2'; // No letter for days
optionsObj.maxDate = '+1 Y'; // M for month, Y for years
}
return optionsObj;
} );
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment