AnsweredAssumed Answered

Comparing dates with javascript

Question asked by liz on Jan 19, 2015
Latest reply on Jan 20, 2015 by liz

I'm having problems comparing two dates in some javascript i have written (i'm new at this).  The code takes a date from the datepicker on a form (EffectiveDate) and the start of the financial year and compares the two.  However even though the dates are  pulling through correctly (i checked the variables through alerts), any date entered seems trigger an alter to say its less than the start of the financial year. I've tried converting the dates to numbers and all sorts of other things and i'm stumped.


Any ideas?


function CheckDate(){


var curDate = new Date();

var curMonth = curDate.getMonth();

var curYear= curDate.getFullYear();

var inputdate = NWF$('#' + varEffectiveDate).datepicker();



var taxYear= curYear

} else {

var taxYear =curYear-1;



var startYear = new Date();






alert("you cannot input a date before the start of the financial year");