PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Unable to Set minDate/maxDate using jQuery UI Datepicker

  1. Anonymous
    Unregistered

    For anyone that's having trouble with the jQuery UI Datepicker, pay extra attention to the version of jQuery UI and the API methods you're using.

    For whatever reason, Gravity Forms v1.6.9 is [as of this writing] using an extremely outdated version of jQuery UI -- they're using a legacy v1.6 (April 2009), when the current release is v1.9 (October 2012).

    The reason this matters is that the Datepicker has undergone significant changes on how it expects date values.

    For example, to set the minDate/maxDate using jQuery UI 1.6, you need to use:

    $('#input_2_15').datepicker('destroy');
    
    $('#input_2_15').datepicker({
    	// Date(yyyy, mm - 1, dd)
        minDate: new Date(2012, 10 - 1, 25),
        maxDate: new Date(2012, 10 - 1, 30)
    });

    In newer versions of jQuery UI, you can use the more common mm/dd/yyyy format:

    $('#input_2_15').datepicker('destroy');
    
    $('#input_2_15').datepicker({
        minDate: '10/25/2012',
        maxDate: '10/30/2012'
    });

    I wasted nearly an entire day debugging this problem.

    If anyone of the Gravity Forms developers are listening, please upgrade your JavaScript libraries, or create a filter to allow us to choose which version we want to use!

    Posted 11 years ago on Thursday October 25, 2012 | Permalink
  2. Thank you for the helpful information. I passed it on to the developers to get their feedback on the jQuery version.

    Posted 11 years ago on Thursday October 25, 2012 | Permalink
  3. Thanks for the feedback Fervor and sorry for the lost time. When the datepicker functionality was originally release with Gravity Forms, it did not come packaged with WordPress. The upcoming version of Gravity Forms (1.7) addresses this issue and uses the packaged datepicker version that comes with WordPress.

    Posted 11 years ago on Thursday October 25, 2012 | Permalink

This topic has been resolved and has been closed to new replies.