Date Field rules using JavaScript questions

rss

Posted by Jdubs - Dec 31 ’14 at 10:21

Here's my code:

var calcDate = new Date();

var Month = calcDate.getMonth() + 1;

var Day = calcDate.getDate() + 3;

var Year = calcDate.getFullYear();

var vStartDate = Month + "/" + Day + "/" + Year;

fd.field('DueDate').value(vStartDate);

 

fd.onsubmit(function()

{

if (fd.field('DueDate').value() < vStartDate)

{

alert("Please enter a Due Date that is 3 or more days in the future.");

return false;

}

else

{

return true;

}

})

 

This was working, but recently stopped working a couple of days ago.

 

Scenario:

  1. On 12/29/2014, users opened the form and tried to submit a form for 1/4/2015 (at least 3 days later, which is correct.)
  2. The alert "Please enter a Due Date that is 3 or more days in the future" pops up (which 1/4/2015 obviously meets that criteria).

Is this because it's the NEW YEAR (2015)?  Or is it because it's the END of the MONTH? (My code above pre-populates a date of 12/32/2014, which obviously isn't possible.

 

Hope that question makes sense.  Thank you!

Displaying 1 to 8 of 8 messages