Copy link to clipboard
Copied
Hi
I would like to find a script that allows me to find this event:
in the field this.getField("DATA").value I insert a date, for example 11/28/2022
in the field this.getField("YEARS").value I insert the number of years, for example 25
I would like to find in the "EXPIRATION" field where I insert the function the last day of the month following the date resulting from the sum.
In this example the result should be 12/31/2047
More examples
Date 12/28/2022 + 25 years = the last day of the month following the expiry = 01/31/2048
Date 12/10/2022 + 25 years = the last day of the month following the expiry = 01/31/2048
Please, can someone help me?
Copy link to clipboard
Copied
Use this as custom calculation script of "EXPIRATION" field:
var date = this.getField("DATA").valueAsString;
var cNum = Number(this.getField("YEARS").valueAsString);
if(!cNum || date == "")
event.value = "";
else{
var d = util.scand("mm/dd/yyyy", date);
d.setFullYear(d.getFullYear() +cNum);
d.setMonth(d.getMonth() + 2);
d.setDate(0);
event.value = util.printd("mm/dd/yyyy",d);}
Copy link to clipboard
Copied
Hi,
Here is my proposal (for not having worked for nothing...) 😉
@+
Copy link to clipboard
Copied
Use this as custom calculation script of "EXPIRATION" field:
var date = this.getField("DATA").valueAsString;
var cNum = Number(this.getField("YEARS").valueAsString);
if(!cNum || date == "")
event.value = "";
else{
var d = util.scand("mm/dd/yyyy", date);
d.setFullYear(d.getFullYear() +cNum);
d.setMonth(d.getMonth() + 2);
d.setDate(0);
event.value = util.printd("mm/dd/yyyy",d);}
Copy link to clipboard
Copied
Than you very much
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thank you very much!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now