Javascript - Problem comparing dates
<p>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?</p>

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