Copy link to clipboard
Copied
I'm working with two date fields. When a date is entered into the first field(LeaseStart_af_date), I need the second field(BillStart_af_date) to display the 1st day of the month following.
So, if Lease Start date is 11/07/2018
Bill Start should be 12/01/2018
I'm using a custom calculation script for BillStart_af_date but it is not calculating. The field 'LeaseStart_af_date' does not use any calculation. Neither field is validated. Both fields have format set to 'Date mm/dd/yyyy'. I'm sure its an error with my script. Any help would be appreciated.
var d = util.scand("mm/dd/yyyy",this.getField("LeaseStart_af_date").valueAsString);
if (d.getMonth() == 11) {
d.setMonth(0);
d.setFullYear(d.getFullYear() + 1);
}
else {
d.setMonth(d.getMonth() + 1);
d.setDate(1);
}
You're not applying the value to the field... Add this line at the end of your code:
event.value = util.printd("mm/dd/yyyy", d);
Copy link to clipboard
Copied
You're not applying the value to the field... Add this line at the end of your code:
event.value = util.printd("mm/dd/yyyy", d);
Copy link to clipboard
Copied
Thank you so much. Gosh - I can't believe I missed that. Works perfectly.