Skip to main content
This topic has been closed for replies.
Correct answer try67

OK, I see now that you did do it, but incorrectly. Use this:

 

var s = this.getField("DatePerformed").valueAsString;
if (s=="") event.value = "";
else {
	var d = util.scand("mm/dd/yyyy", s);
	d.setMonth(d.getMonth() + 3);
	event.value = util.printd("mm/dd/yyyy", d);
}

 

 

1 reply

try67
Community Expert
Community Expert
November 2, 2021

You need to add another condition that checks if the value of the first field is empty, as that would be converted to the current date if you use scand on it.

If you post your code as text it would be easier to help you out with this...

Inspiring
November 2, 2021

Ooops...Sorry about that... Here it is

 

var d = util.scand("mm/dd/yyyy",this.getField("DatePerformed").valueAsString);

if (this.getField("DatePerformed").valueAsString="") event.value = "";

else d.setMonth(d.getMonth() + 3);

event.value = util.printd("mm/dd/yyyy", d);

Inspiring
November 2, 2021

OK, I see now that you did do it, but incorrectly. Use this:

 

var s = this.getField("DatePerformed").valueAsString;
if (s=="") event.value = "";
else {
	var d = util.scand("mm/dd/yyyy", s);
	d.setMonth(d.getMonth() + 3);
	event.value = util.printd("mm/dd/yyyy", d);
}

 

 


Awesome! Works like a champ. Thank you so much!