BlogGuides · November 15, 2026 · 4 min read

Contact Form 7: Test a Rolling Date Window Across Midnight

Set relative limits for a Contact Form 7 date field and test fresh markup, cached pages, and old browser tabs after the business date changes.

A rolling date window in Contact Form 7 can let visitors request an appointment from two days through 30 days ahead. The range appears simple until a page is cached overnight, a visitor submits an old tab, or two teams disagree on which time zone defines the current business day. Set the rule in calendar dates, then verify what a visitor can select and what your form actually accepts as the date changes.

Blank calendar tiles slide between two green stops beside a clock
Generated conceptual illustration.

1. Define the rule as calendar dates

Choose which calendar your business uses for eligibility, such as the time zone of the office that handles the inquiry. Write down which dates are included. In this example, if the business date is November 15, November 17 is the first eligible date and December 15 the last. Both ends are inclusive. The day before and the day after are outside the rule. Counting calendar days avoids treating every day as a fixed 24-hour interval when clocks change.

Decide what happens if someone leaves the page open until tomorrow. One reasonable policy is to apply the current window at submission and ask the visitor to reselect if a date has expired. Another requires a separate booking service that explicitly holds a slot. A date field only collects a request. It does not hold inventory or check whether the office is already booked, and a weekday closure or holiday calendar needs additional logic.

2. Configure the relative bounds

Open the intended CF7 form on staging and use a labeled date field. The following example uses a required field and leaves the visitor to select the date. Use an adjacent instruction that explains the permitted window and, when relevant, whose time zone defines the business date.

[date* requested-date min:today+2days max:today+30days]

The official date field guide documents relative values for min: and max: and underscores for spaces inside form-tag option values. PHP’s relative date format documentation explains date expressions such as today. This example uses the compact style shown by CF7. If another field already uses the same name, give this one a unique name and update its mail tag and any destination mapping together. Avoid a preset date unless it has a business purpose, since a valid default makes it easy to submit a date by accident.

In the rendered page, inspect the date field and record its actual min and max attributes. Compare those strings to the date you expect in the business time zone. Check the configured WordPress time zone and verify the installed CF7 behavior instead of assuming the clock on the visitor’s device decides the limits. If a central backend applies a separate calendar, test its rule with the same fixture dates. A consistent picker alone cannot establish which dates the downstream team will accept.

3. Check the day change with warm and fresh HTML

Before a day change, open the page in one browser tab and leave it open. Also warm the site’s normal page cache by visiting the same page as a signed-out user. After the business day changes, open a newly loaded tab as a visitor and compare its rendered bounds with the old tab. The expected fresh range for November 16 would be November 18 through December 16 in the example. Compare a cold response using the staging site’s authorized cache controls or a known uncached staging route where available. A browser refresh can still fetch an old response from an upstream cache, so inspect the values rather than relying on the refresh action.

For a quiet staging check you can also run the fixture across a planned day change in staging. Record the server and browser zones, exact visit and submit times, and whether the markup was cached. Leave production clocks and caches alone. If signed-out visitors still receive the previous day’s bounds, determine which cache serves that HTML. Possible fixes depend on your setup and include aligning the page’s refresh schedule with the business day or using a form delivery path whose dates are generated for the current request. Then rerun the same warm-page and old-tab cases.

4. Verify acceptance and the stored value

Try exactly the first date, exactly the last date and adjacent dates on either side using the normal staging interface. Record browser feedback separately from the server response. A browser that blocks an out-of-range date before sending a request gives evidence about the picker only. Use the old-tab case to see what a real visitor experiences if the date was once eligible, and confirm the outcome when a captured submission reaches the server. Check a blank input if the field is required. Repeat the calendar boundary test on a mobile picker and with keyboard input on desktop.

For successful fixtures, check that mail and downstream records preserve the selected date as YYYY-MM-DD when the integration expects a date-only string. A user-facing display can format it differently. Keep the distinction clear if a CRM adds midnight and then shifts the label when shown in another time zone. For those mappings, see calendar dates in CRM records. If the visible form itself seems outdated after a change, see diagnosing stale form markup.

Keep the test dates and results with the form change so the next person can verify the window around month-end. For a WordPress view of form activity, see Svetlik Analytics for Contact Form 7.