Gravity Wiz

Magically enhanced tutorials, snippets and plugins for Gravity Forms!

  • Gravity Perks
    • Gravity Perks
    • Tutorials & Snippets
    • About
  • Support
    • Documentation
    • Support
    • Account

How to require a future or past date with Gravity Forms Date Picker

Require dates to be greater than or less than current date (a.k.a. future or past dates).

Last updated August 22, 2019 | Written by David Smith 8 Comments

Steps

  1. Install GP Limit Dates.
  2. Add a Date field to your form.
  3. Future Dates: Set “Minimum Date” to “Current Date”.
  4. Past Dates: Set “Maximum Date” to “Current Date”.

1. Install GP Limit Dates (via Gravity Perks)

GP Limit Dates is available via Gravity Perks. Install Gravity Perks and then you can install GP Limit Dates (and 33 other Gravity Forms plugins) right from your WordPress admin.

2. Add a Date field to your form.

Under the Advanced Fields field group, click the “Date” field button to add a Date field.

gp-limit-dates-add-date-field

3. Future Dates: Set “Minimum Date” to “Current Date”.

Set the “Minimum Date” select to “Current Date” to require a date that is greater than or equal to today. This will automatically adjust to the current date each day.

how-to-require-future-dates-minimum-date
Set Range from Current Date

If you’d like the date to be further in the future (i.e. one week from the current date), you can use the “Date Modifier” input to specify the range from the current date that should be required.

how-to-require-future-dates-date-modifier

4. Past Dates: Set “Maximum Date” to “Current Date”.

Set the “Maximum Date” select to “Current Date” to require a date that is less than or equal to today. This will automatically adjust to the current date each day.

how-to-require-past-date

Did this resource help you do something awesome with Gravity Forms? Then you'll absolutely love Gravity Perks; a suite of 32+ essential add-ons for Gravity Forms with support you can count on.

  • View All Perks
  • Buy Gravity Perks

Filed Under: How To date field datepicker gp limit dates gravity perks

Comments

  1. Joel Wolfgang says

    August 26, 2020 at 10:24 pm

    Any plans to make this work with the Post Field – Custom Field Date? Or is there a trick to make it work?

    Reply
    • Samuel Bassah says

      August 27, 2020 at 8:48 am

      Hi Joel,

      This already works with Custom Field of Date Type. The GP Limit Dates Perks Tab will display on the custom field if you change the Field Type to Date and you can set it up just as you want.

      Best,

  2. Edward says

    February 9, 2020 at 10:35 am

    Hey David, I’ve set up the date picker so that Sundays are the only days available. I want to have users be able to select a Sunday following the previous Friday. I can’t seem to configure it the way I’d like. Somehow, it’s still showing the Sunday available following on the Saturday before and when the current day is Sunday, the current Sunday is available. (if that makes sense).

    How can I set it up to have the user select the Sunday following the day of the week of Friday or before?

    Reply
    • Scott Buchmann says

      February 10, 2020 at 11:55 am

      Hi Edward, this should be possible. Can you drop us a support request for this? We’ll be happy to dig in.

  3. Luke Cavanagh says

    April 27, 2016 at 3:10 pm

    Would there be a way to use this to be able to set a date limit from a previous date field. So the value in the to field could not be greater than today or greater than the value in the from field?

    Thanks in advance.

    Gravity Perks rocks!

    Cheers Luke

    Reply
    • David Smith says

      April 27, 2016 at 4:33 pm

      TLDR; yes! Just replied to your support email. You’re looking for this solution powered by GP Limit Dates.

  4. Andrew says

    August 5, 2015 at 3:15 pm

    David et al., Thanks for creating this perk. Just wanted to let you know that the perk helped streamline one of our forms. I managed to scrap some jQuery together to do something similar. This perk is much more streamlined.

    This is what it helped get rid of:

    <!– var holidays = [“2/17/2015”, “3/17/2015”, “3/19/2015”]; jQuery(“#input_37_9”).datepicker({ minDate: 2, maxDate: new Date(2015, 4, 21), beforeShowDay: function(e) { show = !0, 2 != e.getDay() && (show = !1); for (var a = 0; a < holidays.length; a++) new Date(holidays[a]).toString() == e.toString() && (show = !1); var n = [show, "", show ? "" : "Please only select a Tuesday."]; return n } }), jQuery("#input_37_10").datepicker({ minDate: 2, maxDate: new Date(2015, 4, 21), beforeShowDay: function(e) { show = !0, 4 != e.getDay() && (show = !1); for (var a = 0; a < holidays.length; a++) new Date(holidays[a]).toString() == e.toString() && (show = !1); var n = [show, "", show ? "" : "Please only select a Thursday."]; return n } }); –>

    Thank you guys so much. Awesome work.

    Reply
    • David Smith says

      August 7, 2015 at 9:21 am

      Thanks for sharing, Andrew! I had been doing a lot of this same stuff over and over again in my own work so I decided to streamline the process a bit. Glad it saved you some hassle as well. :)

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Categories

  • How To (63)
  • News (21)
  • Plugins (14)
  • Releases (7)
  • Resource (3)
  • Snippets (58)
  • Tutorials (57)
  • Updates (104)

Recent Posts

  • How to Update Posts with Gravity Forms
  • Gravity Wiz Weekly #104
  • The Complete Guide to Using Gravity Forms With Zapier
  • Gravity Wiz Weekly #103
  • Show Active Forms by Default on Form List

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Copyright © 2021 · Powered by WordPress · Gravity Wiz LLC

  • Support
  • Affiliates
  • About
  • Sitemap
  • Gravity Perks
    ▼
    • Gravity Perks
    • Tutorials & Snippets
    • About
  • Support
    ▼
    • Documentation
    • Support
    • Account