Highlighting the Current or Future Date in the Datepicker

Note: As of Gravity Forms 3.0.0, this snippet is deprecated. Gravity Forms datepickers now use the WhatSock datepicker library. Because of this change, this snippet no longer works, and there is no direct replacement. See Gravity Forms 3.0 Key Features for more on this change.

Introduction

If you need to highlight a current or future date within the datepicker, here’s a code snippet to do it.

Note: You’ll need to replace #input_1_20 with a selector for your field.

Snippet

jQuery.noConflict();
jQuery(document).ready(function($) {
    $( "#input_1_20" ).datepicker({ 
        defaultDate: '+7d',
        minDate: '+7d',
        gotoCurrent: true,
        prevText: '',
        showOn: 'both',
        buttonImage: 'https://s22280.pcdn.co/wp-content/plugins/gravityforms/images/calendar.png',
        buttonImageOnly: true
    });
});

Placement

Reference the article Adding JavaScript Code to the Frontend of Your Site.