Calculate expiration date 14 months from selected date
Hello! I'm trying to figure out how to calculate 14 months from a date in a previous field. I currently have it set up so the "Today" date is autmatically populated upon opening, and need the expiration date to autopupulate 14 months in the future from that date. I have the below script but it comes up with compeltely random numbers. Thank you for the help!
if (event.target.value != "") { // check if populated else script will fail.
var d = new Date(event.target.value); // gets selected date from "Today" field
var DateNextYear = new Date(d.getMonth(), d.getDate(), d.getFullYear() +1);
var fld = this.getField("Expiration");
fld.value = util.printd("mm/dd/yy",DateNextYear); //assign future date to "Expiration" field
//Adjust the field formatting in "fld.value" to match the formatting set for the field. In this case I used "mm/dd/yy".
}
