How to Disallow Future and Past Dates

With the JetFormBuilder WordPress plugin, you can restrict users from selecting dates that are either in the past or in the future. Our forms’ settings provide a wide range of time-based conditions, making them a user-friendly solution for use cases such as appointment forms, time-limited offers, registration deadlines, or any scenario where you need to ensure users select only valid, timely dates.

Table of Contents:

Disable Past Dates

Let’s proceed to the WordPress Dashboard > JetFormBuilder > Forms >  click the Add New Form” button or hit the “Edit” button for an already existing form. 

In this tutorial, we use the booking form Pattern to test the different settings for the Date Field


Let’s proceed to the Date Field settings in the right-side editing tab. Open the Value tab and in the STARTING FROM DATE field, put the following macro:

'%CT::CurrentDate|toDate%'

Ensure that the single quotes (‘…’) are kept.

macro to disable past dates added to the date field

Click the “Save” button once you are ready, and then proceed to the frontend page where the form has been added. 

When we click the Date Field to select a date, we see that all dates before today are disabled and unclickable. 

past dates are disabled on the frontend

Now, users can no longer book a service for a date before today. 

Disallow Selecting Future Dates

Let’s return to the form and see how we can prevent future dates from being selected. 

In this case, we need to use the same macro, but in the LIMIT DATES TO field:

'%CT::CurrentDate|toDate%'
macro to disable future dates added to the date field

Save the form and move to the frontend. Here, we can see that the dates after today are unavailable. 

future dates are disabled on the frontend

Adjust Date Limits by Time Period

Now, let’s focus on limiting the selection by time. For example, the appointment cannot be booked earlier than two days after today. 

Open the form again and proceed to the Date Field settings. Open the Value tab and in the STARTING FROM DATE field, put the following macro:

%CT::CurrentDate|addDay(2)%
macro to disable 2 days after today is added to the date field

You can use the needed number instead of “2”. 

Ensure that the Is Timestamp toggle is enabled. In the Validation tab, choose the “Advanced” option in the VALIDATION TYPE field.

Save the form and open the frontend page. Selecting the tomorrow date results in an error message.

tomorrow date cannot be used on the frontend

When the date five days from now is selected, there is no problem. 

date in 5 days can be selected

If we need to restrict the years to allow users only 18 years old and older, we use a similar macro in the LIMIT DATES TO field:

'%CT::CurrentDate||addYear(-18)%'
macro to disable dates less than 18 years

You can use the needed number instead of “18”.  

In the Validation tab, select the “Advanced” option in the VALIDATION TYPE field. 

Save the form and proceed to the frontend to test it. When we select a date earlier than eighteen years ago, it works correctly.

date 18 years ago works on the frontend

However, when we select a date fifteen years ago, we encounter an error message.

error message when a date 15 years ago is selected

Connecting Two Date Fields Dynamically

Let’s focus on the case where we need to limit the date selection according to the value of another Date Field — for example, the service can be booked for at least seven days. So, the user should not be able to choose a date in the “check-out” field before seven days after the date selected in the “check-in date” field. 

Therefore, we utilize two Date Fields (“check-in date” and “check-out date” in this case). No special settings needed for the “check-in date” field, so we proceed to the “check-out date”. Open the Value tab, in the STARTING FROM DATE field, put the following macro: 

'%check-in-date||addDay(7)|toDate%'
macro to disable 7 days after the checked date is added

Here, the “check-in-date” refers to the name of the Date Field from which we obtain the first date. The “toDate” part disables the days that cannot be selected; without it, the user can click on the date, but will get a notification that this date cannot be selected. 

Save the form and move to the frontend page. For the “check-in date” field, we selected 15.07.2025, and we can see that the following seven days are not available for check-in.

7 following days after the selected date, cannot be checked

Applying Time-Based Restrictions

If you need to restrict form inputs based on a specific time of day — such as allowing submissions only after 9:00 AM or blocking access after a certain hour — it can be done through a time-based macro.

We add the Datetime Field to the form, and in the Value tab, STARTING FROM DATE field, add the following macro: 

'%CT::CurrentDate||addDay(2)|toDateTime%'
datetime restriction macro is added to the datetime field

Save the form and proceed to the frontend page. Here, we can see that we can select a date no earlier than two days after the current date.

datetime restriction works on the front

Now, you know how to restrict users from selecting dates that are either in the past or in the future, or disallow dates according to the date and time dynamically with the help of the JetFormBuilder WordPress plugin.