1

I am currently using this formula to populate the current date into a fillable PDF for work:

var f = this.getField("Today"); 
f.value = util.printd("mm/dd/yyyy", new Date());

This fillable PDF is a government document and once it's printed expires in 45 days including the date printed. Like a Temp Tag for a vehicle.

How do I add 44 days to this formula so that it automatically kicks out 45 days down the road?

nnnnnn
  • 147,572
  • 30
  • 200
  • 241

2 Answers2

1

Here is what you wanna do:

var laterDate = new Date(); // create new Date object set to current date
laterDate.setDate(laterDate.getDate() + 44); // add 44 days 

then you could use your util library and display it:

util.printd("mm/dd/yyyy", laterDate);
Viandoks
  • 156
  • 3
-1

For handling dates in JavaScript, you could use Moment.js. With moment you can perform a wide range of operations on dates and time. Check it's docs for more info. As for your query, you could do

    moment().add(44, 'days');
mayvid14
  • 1
  • 4
  • Answers should not rely on a library that the OP hasn't mentioned or tagged. – RobG Jun 29 '17 at 05:02
  • Sorry, I will keep that in mind. Since it was mentioned before edit that it could use any method, so I suggested that. – mayvid14 Jun 29 '17 at 05:24