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();
if(curMonth>3){
var taxYear= curYear
} else {
var taxYear =curYear-1;
}
var startYear = new Date();
startYear.setDate(1);
startYear.setMonth(3);
startYear.setFullYear(taxYear);
if(inputdate<startYear);
alert("you cannot input a date before the start of the financial year");
}