Gravity Wiz

Magically enhanced tutorials, snippets and plugins for Gravity Forms!

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

Gravity Forms Limit Dates

Limit which days are selectable for your Gravity Forms Date Picker fields.

This plugin is part of Gravity Perks, a suite of 41+ essential Gravity Forms addons with support you can count on.

  • View All Perks
  • Buy Gravity Perks

What does it do?

This plugin allows you to limit the selectable dates in your Gravity Forms Datepicker fields. This plugin gives you granular control to manage the selectable date range with an easy-to-use user interface.

Features

  • Minimum & maximum date range.
    Set a minimum and maximum date range; manually, based on current date, or by date selected in another field.
  • Future/past dates only.
    Require a date greater than the current day.
  • Limit by day of the week.
    Specify which days of the week are selectable.
  • Add exceptions.
    Specify exceptions for specific dates; make any date available or unavailable.
  • Linked date fields.
    Date selected in one date field sets minimum (or maximum) date in another.
  • Timezone support.
    Dates are automatically converted to WP-configured timezone.
  • Date modifiers.
    Modify the min/max date limits by adding or subtracting days, weeks, months or years.
  • Inline datepicker.
    The datepicker can be displayed inline in your form rather than as a popup.
  • Automatic validation.
    Dates are validated even when entered manually; client-side and server-side.
  • Perk integrations.
    Works well with Gravity Forms Read Only for enforcing use of the datepicker.
  • Easy-to-use UI.
    Manage all settings with ease.
  • Automatic updates.
    Get updates and latest features right in your dashboard.
  • Awesome support.
    We’re here to help! And we mean it.

Documentation

  1. How do I enable this functionality?
  2. Feature Details
    1. Minimum Date
      1. Date Modifier
    2. Maximum Date
    3. Days of the Week
    4. Exceptions
    5. Inline Date Picker
    6. Validation
    7. Timezones
  3. FAQs
    1. How can I exclude a blocked day from a Date Modifier?
    2. Can I automatically open the datepicker in Field B after the date has been selected in Field A?
    3. Does this work with the No Duplicates option?
  4. Hooks
  5. Related Articles

How do I enable this functionality?

After installing and activating Gravity Forms Limit Dates, follow these steps to add a Date field and apply limits to it.

Add a Date field to your form.
Click on the Date field to open the field settings. Confirm that the Date Input Type is set to “Date Picker”. This is the only input type that will work with GP Limit Dates. By default, new Date fields will be assigned the “Date Picker” input type.
Navigate to the Perks tab, and configure the Minimum Date, Maximum Date, Days of the Week, and Exceptions settings as desired.

Feature Details

Minimum Date

The minimum date setting allows you to specify the earliest possible date that can be selected in the date field. There are several types of values that are accepted.

  • Date Field
    The earliest date selectable in the current Date field will automatically be adjusted based on the selected date in the specified Date field (i.e Start Date field can set the minimum date in the End Date field).
  • Set Specific Date
    Specify a specific date which will be the earliest date selectable in the current Date field.
  • Current Date
    The current date will be the earliest date selectable in the current Date field. This is a dynamic value and will automatically adjust to the current date with each new day.
Date Modifier

The Date Modifier settings allows you to modify the selected date by adding or subtracting days, weeks, months or years. The date modifier input is available when a Date field or the Current Date option is selected.

Examples

  • Require date to be at least one week from the current date.

    Current Date +1 week

  • Require date to be within the previous year from a user-selected date.

    Date field -1 year

  • Require date to be at least three (3) days from the current date.

    Current Date +3 days

Maximum Date

See Minimum Date above. The same settings apply; however, the setting will impact the latest date selectable rather than the earliest date.

Days of the Week

The Days of the Week setting allows you to limit which dates are selectable based on the days of the week (a.k.a Monday – Sunday). By default, all days are allowed. Click All Days to select specific days that should be selectable. If Saturday and Sunday are selected, only dates that fall on Saturdays and Sundays will be selectable.

Exceptions

Exceptions allow you to negate the date limitations established in the other settings. An exception works with both selectable dates and unselectable dates. If the excepted date is selectable, it will now be unselectable. If the excepted date is unselectable, it will now be selectable.

For example, if Monday through Friday are selected for the “Days of the Week” setting but you would like to make allow a specific Saturday to be selectable, you can add an “exception” for that specific Saturday. Click the Add Exception button and select the desired date from the date picker.

Inline Date Picker

Instead of the drop-down picker you can display the inline calendar. Check Enable Inline Date Picker on the Perks tab to activate the feature.

As shown on the next screenshot, the inline date picker is initially displayed on the page and doesn’t close when you select dates.

Validation

Date fields limited by GP Limit Dates will be validated client-side and server-side. The client-side validation is relevant when users are manually entering dates in the Date field rather than selecting the date via the Date Picker. The client-side validation will notify the user that the entered Date is invalid; however, it will not prevent submission.

The server-side validation will return a validation error if an invalid date is submitted.

Timezones

When the Current Date option is selected for either the Minimum or Maximum Date settings, the current date will be calculated based on the timezone configured on your WordPress settings page. This prevents users in different timezones from selecting a day that has already passed in your timezone.

FAQs

How can I exclude a blocked day from a Date Modifier?

Install the following to automatically exclude blocked days from modifiers.

View CodeDownload Plugin

Can I automatically open the datepicker in Field B after the date has been selected in Field A?

Yep! Use the gpld_after_set_min_date hook as shown in this example.

Does this work with the No Duplicates option?

To automatically limit duplicate dates using No Duplicates, use this snippet. Follow these steps to install and configure the snippet:

  1. Paste everything below the opening <?php line to your theme’s functions.php file.
  2. Update 123 to your Form ID.
  3. Update 1 to your Date field ID.

Hooks

  • gpld_after_set_min_date
  • gpld_invalid_date_error
  • gpld_limit_dates_options
Gravity Forms has hundreds of hooks. Check out our Gravity Forms Hook Reference for the most thorough guide to Gravity Forms’ many actions and filters.

Related Articles

  • How to link Date fields with Gravity Forms
  • How to require a future or past date with Gravity Forms Date Picker
  • How to limit dates to weekdays or weekends with Gravity Forms
  • How to Block a Date Range with Gravity Forms Datepicker
  • Inline Datepickers with Gravity Forms

Perk Deets

  • Version 1.1.9
  • Updated January 25, 2022
  • Released July 13, 2015
  • View Changelog

Changelog

1.1.9

  • Fixed issue with GP Read Only where the Datepicker would be initialized more than once causing a flash of unstyled content when using Legacy Markup.
  • Added "Update URI" to plugin header to improve security.

1.1.8

  • Fixed regression where having an empty minimum date could cause the form to lock up.

1.1.7

  • Improved minimum date to be the first selectable date in the range.

1.1.6

  • Fixed an issue where back-end validation did not match the front-end when excepted dates fall outside of minimum or maximum dates defined.

1.1.5

  • Added support for responsively downsizing the datepicker.

1.1.4

  • Added gpld_after_set_max_date

1.1.3

  • Fixed an issue where GPPA and GPCC would not copy values from inline date pickers on page load.

1.0.26

  • Added gp-limit-dates.css for GF 2.5.. Updated inline datepicker style in GF 2.5 to remove drop shadow.
  • Added support for 2.5.
  • Updated admin scripts/styles to be enqueued as separate files rather than output inline.
  • Updated field setting markup, styles, and JS to work better in GF 2.5.
  • Updated field setting styles in GF 2.4 to work with the new markup.
  • Fixed issue where Inline Datepicker did not have the new GF datepicker theme applied automatically.

1.1.2

  • Fixed an issue where second and subsequent inline date pickers may not render on a form.

1.1.1

  • Fixed an issue where Inline Datepickers were not always populated with the correct default value.

1.1

  • Added support for Gravity Forms 2.5.
  • Updated admin scripts/styles to be enqueued as separate files rather than output inline.
  • Updated field setting markup, styles, and JS to work better in GF 2.5.
  • Updated field setting styles in GF 2.4 to work with the new markup.
  • Updated inline datepicker style in GF 2.5 to remove drop shadow.
  • Fixed issue where Inline Datepicker did not have the new GF datepicker theme applied automatically.

1.0.25

  • Fixed a potential integration issue with GPPA and GPRO.

1.0.24

  • Updated data flag to gpldIgnoreChange so it could be used in more contexts.
  • Added support for triggering onSelect functionality when the Date field's value changes.

1.0.23

  • Fixed an issue where a deleted field may cause GPLD to fail to render.

1.0.22

  • Added gpld_invalid_date_error JavaScript filter.

1.0.21

  • Fixed an issue where date format was parsed incorrectly.

1.0.20

  • Fixed noticed generated when invalid form is passed via GF filters.
  • Updated plugin author.

1.0.19

  • Added JS filter: gpld_after_set_min_date; supports functionality such as populating the new minimum date into the field and opening the datepicker in Field B after a date has been selected in Field A.

1.0.18

  • Fixed fatal error that occurred when honey pot was enabled on form with Limit Dates active.

1.0.17

  • Added GP_Limit_Dates::get_limit_dates_field_options method to ensure that the generic "gpld_limit_dates_options" filter was applied when fetching options for a single field.

1.0.16

  • Added fix to resolve issue where min/max dates were not set for Inline Datepickers after an AJAX-submission.

1.0.15

  • Fixed issue where inline datepickers did not correctly show first selectable date.

1.0.14

  • Fixed issue where inline datepickers did not currently display selected date when rendered while hidden (via conditional logic).

1.0.13

  • Fixed issue with 2.4 and new $field->fields property.

1.0.12

  • Added support for script/style minification.
  • Added support for GP Limit Dates inline datepicker.

1.0.11

  • Fixed issue where change event was not triggered for inline datepickers when new min/max date was set.

1.0.10

  • Fixed notice generated with PHP 7.2 when days of the week setting was not defined as an array.

1.0.9

  • Fixed bug introduced in 1.0.8 where minDate field-based dependencies were accounted for but maxDate's were not.

1.0.8

  • Added support for automatically setting Date field minDate by the minDate of the Date field on which it's minDate is dependent.

1.0.7

  • Fixed issue where default value in Date Field A did not correctly set the minimum date for Date Field B when configured to do so.

1.0.6

  • Fixed issue where manually entered dates were not correctly validated on input change event.

1.0.5

  • Fixed issue where conditional logic was not working when dependent on any Date field which used the onSelect event.

1.0.4

  • Fixed issue where conditional logic was not working when dependent on an Inline Date Picker.

1.0.3

  • Fixed issue introduced in 1.0.2 where an error was generated if the datepicker was reponsible for setting the min/max on more than one Date field.

1.0.2

  • Fixed issue where inline datepicker did not automatically updated min/max date when targeted by another Date field.

1.0.1

  • Fixed issue where inline datepicker did not work for any date format other than mm/dd/yyyy.

1.0

  • Added support for inline datepicker.
  • Updated admin UI styles.

1.0.beta2.12

  • Fixed conflict caused by Gravity Slider's jquery.nouislider.all.js file

1.0.beta2.11

  • Added gpld_modified_date JS filter to allow 3rd party modifications to any modified date

1.0.beta2.9

  • Added support for disableAll property on date option data; allows all dates to be disabled by default.

1.0.beta2.8

  • Fixed issue where jQuery was used instead of $ inside gp-limit-dates.js

1.0.beta2.7

  • Fixed issue introduced by WordPress 4.6 where admin datepickers are localized by default causing date to be in an unexpected format

1.0.beta2.6

  • Fixed issue where deleted date fields still set as min/max date for another date field would generate a JS error

1.0.beta2.5

  • Updated 'gp-limit-dates.js' to be enqueued in footer; resolves conflict with GP Nested Forms

1.0.beta2.4

  • Added support for "exceptionMode" via 'gpld_limit_dates_options' filter; allows modifing how excepted dates are handled (blocked, enabled, reversed).

1.0.beta2.3

  • Updated to make gform_datepicker_options_pre_init filter more bullet proof

1.0.beta2.2

  • Added new filter: gpld_date_value add_filter( 'gpld_date_value', function( $date, $field, $key, $options ) { return $date; }, 10, 4 );
  • Added GP_Limit_Dates::is_valid_timestamp() function
  • Updated GPLimitDates.gpld_date_value() method to pass the data and fieldId parameters

1.0.beta2.1

  • Added new filter: gpld_has_limit_dates_enabled add_filter( 'gpld_has_limit_dates_enabled', function( $result, $field ) { return false; }, 10, 2 );

1.0.beta2.0

  • Fixed issue where empty date fields w/ limit date features enabled returned a validation error
  • Updated to use GP_Bootstrap

1.0.beta1.9

  • Updated onClose override to account for other functions that have also specified an onClose function for the datepicker

1.0.beta1.8

  • Fixed issue where field ID and specific dates were converted to server time which could result in incorrect date limits; updated to only convert {today}-based dates to server time

1.0.beta1.7

  • Fixed issue where setting limit date options via the 'gpld_limit_dates_options' filter did not activate limit dates functionality for the form if there were no options already configured for the field.

1.0.beta1.6

  • Fixed styling issue where date selects (in UI) were too large when Date fields had very long labels

1.0.beta1.5

  • Added $form and $field objects as parameters to the 'gpld_limit_dates_options' filter
  • Added support for 'Exclude Before Today' option when min date setting is configured for 'Specific Date'; allows specifying a future minimum date and having minimum date automatically adjust as time progresses

1.0.beta1.4

  • Fixed issue where dates in dmy format would return invalid date validation error
  • Fixed issue where date fields with min/max set by another date field with a dmy format would not have the min/max set correctly when a validation error is returned on any form field

1.0.beta1.3

  • Fixed issue where days of week validation was sometimes not stored in correct format
  • Fixed issue where PHP date validation failed for non-US dates (in some cases)
  • Added support for allowing multiple date fields to have min/max date fields based on the same date field

1.0.beta1.2

  • Fixed issue where dates in dmy format where not validated correctly (on submission)
  • Fixed issue where field settings appeared briefly while form editor was loading

1.0.beta1.1

  • Fixed issue where if Sunday was the only day of the week, no limit was applied

1.0.beta1.0

  • Limit those dates!

All Perks

  • GF Address Autocomplete
  • GF Advanced Calculations
  • GF Auto List Field
  • GF Auto Login
  • GF Better User Activation
  • GF Blocklist
  • GF Conditional Logic Dates
  • GF Conditional Pricing
  • GF Copy Cat
  • GF Date Time Calculator
  • GF Disable Entry Creation
  • GF Easy Passthrough
  • GF eCommerce Fields
  • GF Email Users
  • GF Entry Blocks
  • GF Expand Textareas
  • GF File Upload Pro
  • GF Inventory
  • GF Limit Checkboxes
  • GF Limit Choices
  • GF Limit Dates
  • GF Limit Submissions
  • GF Live Preview
  • GF Media Library
  • GF Multi-Page Navigation
  • GF Nested Forms
  • GF Notification Scheduler
  • GF Page Transitions
  • GF Pay Per Word
  • GF PayPal One-time Fee
  • GF Placeholder
  • GF Populate Anything
  • GF Post Content Merge Tags
  • GF Preview Submission
  • GF Price Range
  • GF QR Code
  • GF Randomizer
  • GF Read Only
  • GF Reload Form
  • GF Terms Of Service
  • GF Unique ID
  • GF Word Count

Copyright © 2022 · Powered by WordPress · Gravity Wiz LLC

  • Support
  • Affiliates
  • About
  • Sitemap
  • Terms & Conditions of Use
  • Privacy Policy
  • Cookies Policy

Get access to hundreds of Gravity Forms plugins for free!

Enter your email and receive a list of our most popular free snippets and plugins for Gravity Forms.

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