Skip to main content
New Participant
March 11, 2021
Answered

Add 60 Days from input Date field into another field

  • March 11, 2021
  • 1 reply
  • 1509 views

I am very much a novice when it comes to script.

 

However, I have this Date picker field, called "Issue Date". and I want it to calculate +60 days from the date selected in the Issue Date field and input it in another field called "Expiration Date"

 

Please explain to me how I can do that?  Where do I put in the code and what the code should be?

 

Thank you!

 

Drew

This topic has been closed for replies.
Correct answer Nesa Nurani

As "Validation script" of "Issue Date" field use this:

if(event.value == "")
this.getField("Expiration Date").value = "";
else{
var days = util.scand("dd-mmm-yyyy", event.value)
days.setDate(days.getDate() +60);
this.getField("Expiration Date").value = util.printd("dd-mmm-yyyy", days);}

 

 

Change date format from "dd-mmm-yyyy" to something else if you wish.

1 reply

Nesa Nurani
Nesa NuraniCorrect answer
Community Expert
March 11, 2021

As "Validation script" of "Issue Date" field use this:

if(event.value == "")
this.getField("Expiration Date").value = "";
else{
var days = util.scand("dd-mmm-yyyy", event.value)
days.setDate(days.getDate() +60);
this.getField("Expiration Date").value = util.printd("dd-mmm-yyyy", days);}

 

 

Change date format from "dd-mmm-yyyy" to something else if you wish.

Drew5EE8Author
New Participant
March 11, 2021

wow!  This is perfect!

 

Thank you so much!!  This is a huge help to the project I was working on!!