PDF Editing Issues

How to Automatically Fill a Two-Week Date Range in an Acrobat PDF Form

Jason MillerJason Miller Nov 10, 2026 869 views

Question details

The user wants to configure a fillable PDF timesheet so that entering a starting date automatically fills in the dates for the subsequent 14 days.

How to Automatically Fill a Two-Week Date Range in an Acrobat PDF Form
Product
Adobe Acrobat
Device & OS
not provided
Scenario
Creating an automated timesheet or schedule in a PDF form where a user only needs to input the first day, and the form dynamically generates the rest of the two-week date range.
Observed behavior
Manual entry of 14 consecutive dates is inefficient. A custom validation script is required to parse the initial date and iteratively calculate and format the next 14 fields.
Before you start

Verify that your PDF form has all the necessary text fields created. Standardize your naming convention (e.g., CalendarMain for the start date, and Date1 through Date14 for the rest) to make the scripting process smoother.

Solution 1Recommended

Use Custom JavaScript Validation in Adobe Acrobat

Apply a custom JavaScript snippet to the starting date field's validation properties to calculate and distribute the dates to the other fields.

By utilizing Acrobat's built-in JavaScript engine, you can read the value of an input field, manipulate it as a Date object, and output it to other form fields.

This method relies on util.scand to read your date format and util.printd to format the output. It calculates the next days by adding 86,400,000 milliseconds (one day) for each subsequent iteration.

1
Set Up Your Target Form Fields

Open your PDF form in Adobe Acrobat. Create a main text field for the starting date and name it 'CalendarMain'. Then, create 14 additional text fields and name them 'Date1' through 'Date14'.

2
Access Field Properties

Right-click the 'CalendarMain' field, select Properties from the context menu, and navigate to the Validate tab.

3
Enable Custom Validation Script

Select the 'Run custom validation script' option and click the Edit button to open the JavaScript Editor.

4
Write the Date Calculation Script

In the editor, write a script that checks if 'event.value' is empty. If it is, clear 'Date1' through 'Date14'. If it has a date, use util.scand() to convert the input into a date object, add one day's worth of milliseconds iteratively in a loop, and use util.printd() to push the formatted date into fields 'Date1' through 'Date14'.

5
Test the Output

Close the editor and save the properties. Switch to Preview mode, enter a date into the 'CalendarMain' field, and verify that the 14 subsequent date fields populate correctly.

Use Custom JavaScript Validation in Adobe Acrobat
Formatting Matters: Ensure that the date format string you pass to util.scand (e.g., 'mm/dd/yyyy') perfectly matches how users will type the date into the CalendarMain field.
Edit PDF Forms Easily

Create and Manage Interactive PDF Forms with WPS Office

If you frequently work with fillable PDFs, timesheets, and invoices, WPS Office provides a lightweight, highly intuitive PDF editor that allows you to easily insert text fields, manage properties, and handle document formatting.

  1. 1. Open WPS PDF: Launch WPS Office and open your existing PDF document or create a new one from a template.
  2. 2. Navigate to the Form Tab: Click on the 'Form' tab in the top navigation ribbon to reveal all interactive form controls.
  3. 3. Insert Form Fields: Select 'Text Field' and click on your document to place the date fields where you need them.
  4. 4. Save and Distribute: Once your form fields are aligned and named, save the PDF to easily share your fillable timesheet with your team.
Easily insert text fields, checkboxes, and date pickers into any PDFFully compatible with standard Adobe Acrobat PDF form formatsLightweight alternative with an intuitive user interface for quick editingComprehensive PDF management including merging, signing, and converting
microsoft office alternative - wps office

Frequently Asked Questions

Why is my Acrobat JavaScript throwing a syntax error on the date calculation?

This usually occurs if the field names in your script do not exactly match the field names in the PDF form (e.g., 'date1' instead of 'Date1'), or if the util.scand date format does not align with the input.

Can I auto-fill a 30-day range instead of a two-week range?

Yes. You just need to ensure you have 30 output text fields created in your form (e.g., Date1 through Date30) and increase the loop count in your JavaScript from 14 to 30.

Will these automated date calculations work if someone opens the PDF in a web browser?

Often, they will not. Most built-in browser PDF viewers (like Chrome or Edge) strip out or do not fully support advanced Acrobat JavaScript. Users should download the file and open it in a dedicated PDF reader for the automation to work.