How do I create a text field that auto-populates a date three years from the current date?
I am trying to create a PDF form that will auto-populate an expiry date three years in the future from the current date in a created text field.
Text field name: ExpDate
Text field format: mm/dd/yy
So far I have entered the following into Page Properties --> Actions --> Add an Action (Trigger = Page Open, Action = Run a JavaScript):
var ExpDate = new Date();
ExpDate.setYear(ExpDate.getYear()+3);
var f=this.getField("ExpDate");
f.value=util.printd("mm/dd/yy", ExpDate);
This will produce the correct expiry date on the day that I make the certificate (i.e. it will read 06/07/16 on June 7, 2016), but when I open it the next day it will still ready 06/07/16 instead of 06/08/16. I am sure it is something simple that I need to change. Any ideas?
