How to Calculate a Date One Year Minus One Day in an Acrobat PDF Form
Question details
The user needs to create an automated Acrobat JavaScript calculation that populates a second date field with a date exactly one year after the first date, minus one day.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Setting up interactive PDF form calculations where a contract, subscription, or validity period automatically determines its end date based on the start date.
- Observed behavior
- Requires a custom JavaScript script to parse the initial date, perform date math to add a year and subtract a day, and format the output correctly for the second field.
Ensure that your first date field is properly named (e.g., 'Date1') and that you know the exact date format you are using (like 'mm/dd/yyyy') before inserting the calculation script.
Use a Custom JavaScript Calculation Script
Apply a custom calculation script to your second date field that reads the first date, manipulates the year and day values, and outputs the result.
Acrobat PDF forms utilize JavaScript for advanced calculations. By reading the value from the initial field, you can use the built-in Date object and utility functions (util.scand and util.printd) to manipulate the timeline before displaying it.
Open your PDF document in Adobe Acrobat Pro. Navigate to 'Tools' and select 'Prepare Form' to enter the form editing mode.
Right-click on the destination date field (the one you want to automatically populate) and select 'Properties' from the context menu.
Go to the 'Calculate' tab in the Properties dialog box. Select the option 'Custom calculation script' and click the 'Edit' button.
In the JavaScript Editor, paste the following code: var cDate = this.getField("Date1").value; if (cDate) { var d1 = util.scand("mm/dd/yyyy", cDate); d1.setFullYear(d1.getFullYear() + 1); d1.setDate(d1.getDate() - 1); event.value = util.printd("mm/dd/yyyy", d1); } Make sure to replace "Date1" with the exact name of your first date field.
Click 'OK' to close the editor, then close the Properties dialog. Exit the 'Prepare Form' mode and enter a date in the first field to verify the second field updates correctly.

Manage and Fill Interactive PDF Forms with WPS Office
If you are working with interactive PDF forms, WPS Office provides a robust, lightweight PDF editor that allows you to seamlessly fill out, manage, and interact with complex PDF documents without needing heavy software.
- 1. Download and Install WPS Office: Get WPS Office from the official website and launch the application.
- 2. Open Your PDF Form: Click on the 'PDF' tab on the home screen and open the interactive PDF form you need to fill or review.
- 3. Fill the Form Fields: Click directly into the text or date fields. WPS PDF will recognize interactive form layers and allow you to input your data smoothly.
- 4. Save and Export: Once your form is completely filled out, navigate to 'Menu' > 'Save As' to store your completed document, or use the export options to share it securely.

Frequently Asked Questions
Can I use a different date format like dd/mm/yyyy?
Yes. To use a different format, change the format string inside the script's utility functions. For example, replace util.scand("mm/dd/yyyy", cDate) with util.scand("dd/mm/yyyy", cDate) and update util.printd exactly the same way.
Why is my calculated date field remaining blank?
This usually happens if the field name in your script (e.g., "Date1") does not match the actual name of your first date field in the form properties. It can also occur if the date format you typed into the first field does not perfectly match the mm/dd/yyyy format expected by the script.
How do I perform this date calculation in Adobe Sign?
Adobe Sign relies on its own expression builder instead of Acrobat JavaScript. While simple additions like addDate("y", 1, Date1) work to add a year, mixing subtractions (minus one day) requires chaining Adobe Sign's specific calculated field syntax, which differs heavily from standard JavaScript.




