Copy link to clipboard
Copied
I am trying to add 10 days to a date which a user enters into a form. I have created a date field "Date1", I have created a Date field "Date2". In the Calculate tab , under Custom Script, i placed the following code
var s1 = this.getField("Date1").valueAsString;
if (s1=="") event.value = "";
else {
var d1 = util.scand("dd/mm/yyyy", s1);
d1.setDate(d1.getDate()+30);
event.value = util.printd("dd/mm/yyyy", d1);
}
It does not work (I took this code from a previous post)
I have tried simple calculated fields like adding two numbers together, and i can get that to work
Copy link to clipboard
Copied
Did you format fields as dd/mm/yyyy ?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Change +30 to +10... Also, check the JS Console for errors.
Copy link to clipboard
Copied
Got it, thank you, my error was inconsistant formatting between the two fields