>Javascript Comparing 2 dates
<p>I have this code in comparing dates</p>

<pre><code>var startDate = jQuery("#startDate_field_id").val();
var endDate = jQuery("#endDate_field_id").val();
var startDateSplit = startDate.split("-");
var endDateSplit = endDate.split("-");
var start = new Date();
var end = new Date();
start.setFullYear( startDateSplit[0], startDateSplit[1], startDateSplit[2] );
end.setFullYear( endDateSplit[0], endDateSplit[1], endDateSplit[2] );

if( end &lt; start ) {
 alert("End Date should be less than Start Date of the Event");
}
</code></pre>

<p>The value of #startDate_field_id is <strong>2011-10-05</strong>
<br>
white the value of $endDate_field_id is <strong>2011-10-04</strong></p>

<p>What do you think is the reason why this isn't working.</p>

<p>Any help would be greatly appreciated and rewarded. 
Thanks! :)</p>
