Javascript - Problem comparing dates
The code below is giving me trouble.  When I select July 1st 11:00pm for fromDate, result 3 is being set to Thu Jun 02 2011 11:52:26.  I check the values of fromDate and toDate in chrome and they seem fine but result 3 is getting set to a wacky date.  Any solutions?

    function(value, element, params) {
    			fromDate = new Date(startDate.val());
    			toDate = new Date(endDate.val());
    			result1 = this.optional(element);
    			result2 = fromDate <= toDate;
    			result3 = new Date();
    			result3.setDate(fromDate.getDate()+1);
    			result5 = (toDate.getDate()+0);
    			result4 = (fromDate.getDate()+1)>(toDate.getDate()+0);
    			return result1 || (result2 && result4);
    		}
Javascript - Problem comparing dates
===

The code below is giving me trouble.  When I select July 1st 11:00pm for fromDate, result 3 is being set to Thu Jun 02 2011 11:52:26.  I check the values of fromDate and toDate in chrome and they seem fine but result 3 is getting set to a wacky date.  Any solutions?

    function(value, element, params) {
    			fromDate = new Date(startDate.val());
    			toDate = new Date(endDate.val());
    			result1 = this.optional(element);
    			result2 = fromDate <= toDate;
    			result3 = new Date();
    			result3.setDate(fromDate.getDate()+1);
    			result5 = (toDate.getDate()+0);
    			result4 = (fromDate.getDate()+1)>(toDate.getDate()+0);
    			return result1 || (result2 && result4);
    		}