Image

Imagedonewithyou wrote in Imagejavascript 😡frustrated

I'm trying to test if a date entered is greater than 2 years from today's date and if not, an alert should say "Warning: Contract requires a 2 year wait prior to annuitization" The following works, but not for July. It only lets you continue with a date of June or earlier. Any ideas?



Here's my code:

var now = new Date();
var then = new Date(issDtYYYY, issDtMM, issDtDD, 0, 0, 0, 0);
if ( (now.getTime() - then.getTime()) < (2*365*24*3600*1000) ) {
alert('WARNING: Contract requires a 2 year wait prior to annuitization');
return false;
}

return true;
}