Hello,
I am just a starter with JS, but I am trying to fill a Field with a correct Rule in FP. This I would like to use in MarcomCentral for setting up a Version Product for contracts.
I did set-up the Field "Months" and two other Fields for "Start Date" and "End date". I would like to use the calendar in MC to fill in the start date, and it will be in the format dd-mm-yyyy.
For example the Field Months need to be filled as an open filled or drop down with 36, 48 or 60.
I did setup a rule like below, but it is totally not correct. The part of showing the right format is wrong, but more problems with correct calculation.
What am I doing wrong?
I think a lot, but please help:p
var s = Field("Start Date");
var myDate = new DateFromString(Field("Date"));
myDate.setMonth(myDate.getMonth() + Field("Months"));
return FormatDate(myDate, "dd/mm/yyyy");