Help with script to add business days to a date and display the new date in an Adobe form.
There has got to be a very easy solution but I am stumped and can't figure it out or find anything online that answers it! PLEASE HELP!
I'm working on a PDF where the user enters a date in field "DebriefDate." I have a script that will populate a subsequent date field and add two days to the original date to provide a second due date for an additional step in the process. What I need is for the script to ignore weekends.
For example:
User types 03/11/2016 in the "DebriefDate" field :: I need the "d1" field to populate 03/14/2016" to take into account that 3/13 is a weekend date.
Also, I am NOT concerned about holidays unless that is extremely simple to include.
This is the code I currently have:
// ---> start code
/* Create a date object containing the date from the DebriefDate field. */
var d1 = new Date(this.getField("DebriefDate").value);
/* num contains the numeric representation of the current date. */
var num = d1.valueOf();
/* Add two days to DebriefDate. */
/* 2000 ms / sec; 60 sec / min; 60 min / hour; 24 hours / day */
num += 2000 * 60 * 60 * 24;
/* Create our new date that is one day ahead of the current date. */
var d2 = new Date(num);
/* Print out the current date and our new date using util.printd */
- event.value =util.printd("mm/dd/yyyy", d2);
// ---> end code
Thank you in advance for all solutions!!
