PDF Editing Issues

How to Validate That an End Date Is After a Start Date in Adobe Acrobat

Amos GikundaAmos Gikunda Nov 5, 2026 869 views

Question details

The user wants to set up a validation rule in an Adobe Acrobat fillable PDF so that the End Date entered by a respondent is strictly after the Start Date.

How to Validate That an End Date Is After a Start Date in Adobe Acrobat
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Creating or editing a fillable PDF form with date fields that require logical validation.
Observed behavior
Setting up custom validation logic to prevent users from entering an End Date that occurs before or on the same day as the Start Date.
Before you start

Ensure your PDF form already contains two properly formatted text fields designated for dates, specifically named for the Start Date and End Date, and that both share the exact same date format setting.

Solution 1Recommended

Add Custom JavaScript Validation to the End Date Field

Use a custom JavaScript snippet in the End Date field properties to compare the two date values and reject invalid inputs automatically.

Adobe Acrobat requires custom JavaScript to compare the values of two different form fields. By adding a script to the End Date field, Acrobat will automatically verify the input against the Start Date field every time a user fills it out.

The script converts both date strings into JavaScript Date objects so they can be mathematically compared. If the validation fails, the input is rejected.

1
Open Prepare Form Mode

Open your document in Acrobat, navigate to the Tools menu, and select 'Prepare Form' to enable form field editing.

2
Access End Date Properties

Right-click on your End Date field and select 'Properties' from the context menu. Navigate to the 'Validate' tab.

3
Enable Custom Validation

Select the 'Run custom validation script' radio button and click the 'Edit' button to open the JavaScript editor window.

4
Input the JavaScript Code

Write a script that retrieves the Start Date value using 'this.getField("YourStartDateField").value'. Convert both this value and the current field's value (event.value) to Date objects. Compare them, and if the End Date is less than or equal to the Start Date, set 'event.rc = false' and optionally trigger an 'app.alert()' message.

5
Save and Test

Click 'OK' to close the editor, then close the Properties dialog. Save your PDF and enter test dates to ensure the validation rejects earlier End Dates correctly.

Add Custom JavaScript Validation to the End Date Field
Date Format Matching: Make sure that both the Start Date and End Date fields use the exact same date format (e.g., mm/dd/yyyy) in their Format tab to avoid script parsing errors.
Efficient PDF Management

Edit, Fill, and Manage PDF Forms with WPS Office

While complex JavaScript validation requires specialized form-builder tools, WPS Office provides a powerful, lightweight, and user-friendly PDF editor to effortlessly create, fill, sign, and manage PDF documents on any device.

  1. 1. Open WPS PDF: Launch WPS Office and open your interactive PDF form.
  2. 2. Access Form Tools: Navigate to the 'Form' or 'Fill & Sign' tab on the top ribbon.
  3. 3. Input Data: Click directly on the highlighted text fields, including Start and End dates, to input your data easily.
  4. 4. Save and Share: Save the completed form locally or export it as a flattened PDF to securely share your information.
Seamlessly fill out and interact with PDF form fieldsFully compatible with standard PDF formats and Adobe Acrobat filesLightweight suite combining Writer, Spreadsheet, Presentation, and PDF toolsFree to use with a clean, familiar user interface
QA img-9

Frequently Asked Questions

Why isn't my JavaScript date validation working in Acrobat?

This usually happens if the date formats specified in the 'Format' tab do not match exactly between the Start Date and End Date fields, or if the exact field names referenced in your JavaScript do not match the actual names of your form fields.

Can I validate dates in a PDF without using custom JavaScript?

No, Adobe Acrobat requires custom JavaScript for comparing two distinct fields. The built-in standard validation only checks if a single field matches a specific format or falls within a hardcoded numerical range.

How do I show an error message when the wrong date is entered?

Within your custom validation script, you can use the 'app.alert("Your error message here");' function right before setting 'event.rc = false;'. This triggers a pop-up warning the user that their End Date is invalid.