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.

Date Drop Down - future dates

  1. howdy
    Member

    The date drop down is one of the most usable elements of gravity forms - for international form fillers this removes any confusion over date formats.

    The biggest issue is the years are only in the past (and one year into the future).

    Would it be possible to add a switch for future dates? This would be incredibly handy for people specifying dates in the future.

    2013
    2014
    2015
    etc.

    Posted 11 years ago on Saturday January 12, 2013 | Permalink
  2. It appears there are already filters for that: gform_date_max_year and gform_date_min_year.

    http://www.gravityhelp.com/documentation/page/Gform_date_max_year
    http://www.gravityhelp.com/documentation/page/Gform_date_min_year

    Here is how I used it to change my drop down:

    [php]
    add_filter('gform_date_max_year', 'change_max_year');
    function change_max_year($max_year) {
        return date('Y') + 7;
    }
    add_filter('gform_date_min_year', 'change_min_year');
    function change_min_year($min_year) {
        return '1977';
    }
    Posted 11 years ago on Saturday January 12, 2013 | Permalink
  3. howdy
    Member

    Thanks Chris, very handy. The only issue with this is the years are in reverse, so looks kind of strange:
    2018
    2017
    2016
    2015
    2014
    2013

    Would be more logically if future dates were ascending. I vote for a "future dates" switch on the date drop down field - which would automatically add similar filters and list the years in ascending order

    Posted 11 years ago on Saturday January 12, 2013 | Permalink
  4. I'l tag this too as a feature request. Thank you for the suggestion.

    Posted 11 years ago on Sunday January 13, 2013 | Permalink