Cannot use directed Date format for date fields extracted to numeric value field
It amazes me that anyone could become proficient at JS in acrobat let alone a subject matter expert. As one issue is successfully addressed, it begets another new issue -- read headache. 😉
After failing to account for months w/ 31 days (and leap year) in my original scripting attempts, I have taken a different tack successfully addressing the 31 day problem... only to encounter a new problem. :S
The two (2) date fields sourcing the third field require a display/entry format of dd mmm yy with the third field displaying the numeric differential between the two (2) date fields. Unfortunately, the third field errors out if I use anything other than a four digit year (i.e. yyyy) in the two (2) date fields. My sincerest appreciation in advance for any and all assistance.
The error: "Warning: JavaScript Window- XThe value entered does not match the format of the field [Deviation_Days_Actual_Start]
The script I've entered in the Deviation_Days_Actual_Start "Custom calculation script" area:
var sDate1= new Date(this.getField("Actual_Date_Start").value);
var sDate2= new Date(this.getField("Proposal_Date_Start").value);
var date1 = new Date(sDate1.getFullYear(), sDate1.getMonth(), sDate1.getDate());
var date2 = new Date(sDate2.getFullYear(), sDate2.getMonth(), sDate2.getDate());
var millisecondsPerDay = 1000 * 60 * 60 * 24;
var millisBetween = date1.getTime() - date2.getTime();
var days = millisBetween / millisecondsPerDay;
var eDays = Math.floor(days)
event.value = eDays;