I think the two alerts below should have the same value, but they are slightly different. The begtrandate variable is in the format mm/dd/yyyy and the mintrandate is in the default (time?) format. What I really need to do is set the mintrandate variable to the current date minus a certain number of days (or full years, preferably). I'm reasonably new to Javascript and can't seem to find the right solutions online for this. Looks like I'll be doing a fair amount more in the near future, so any help or resources are appreciated.
//Set the two dates to compare
var mintrandate=new Date();
var begtrandate=new Date(document.ERLiabHis.BegTranRange.value);
alert("Beg: " + begtrandate.getTime());
alert("Min: " + mintrandate.getTime());
if (begtrandate.getTime() < mintrandate)
{
mvalid = "f";
alert("The Start Date must be no more than 2 years prior to today's date.");
document.ERLiabHis.BegTranRange.focus();
document.ERLiabHis.BegTranRange.select();
event.returnValue=false;
return false;
}