Skip to main content
Nintex Community Menu Bar

Add due date (15 days from schedule date)

  • May 24, 2017
  • 1 reply
  • 3 views

Forum|alt.badge.img+2

I have the following javascript and it only adds day and does not change month. Anything wrong with the code?

For example, this example I am using the current date.

The due date is showing 5/8/2017 instead of 6/8/2017 

May 25 2017 - Updated the following code by adding +1 with getMonth(). The code is now working.

var date = new Date();
date.setDate(date.getDate() + 15);
var control = NWF$("#"+ jsDueDate);
if(control.val() == "")
{
control.val(date.getMonth()+1 + "/" + date.getDate() + "/" + date.getFullYear());
}

1 reply

Forum|alt.badge.img+14
  • Scholar
  • May 24, 2017

it's because getMonth() returns zero based value.

ie. January == 0

so you have to use date.getMonth()+1