Add X months field to a defined date
I'm trying to create a custom calculation script in adobe acrobat pro to do the following:
Commencement date field - enter date
Term field - enter number of months - for example 6 months
End date - calculate by taking the commencement date and adding the number of months specified in the term field.
Here's what I currently have - the month changes depending on whats in the term field but for some reason it's added 4 year so to the end date. What do I need to change for this script to work. Many thanks in advance for any ones help 🙏
var getMonth = this.getMonth("TERM"); var strDate = this.getField("COMMENCEMENT DATE").valueAsString; // Test for date format if (/\d{1,2}\/\d{1,2}\/\d{2}/.test(strDate)) { var dt= util.scand("dd/mm/yyyy", strDate); dt.setMonth(dt.getMonth()+getMonth); dt.setDate(dt.getDate()-1); event.value=util.printd("dd/mm/yyyy",dt) } else {event.value=""}
