Comparing 2 dates (failing if one of the dates is in following year)
<p>The code below works fine if the 2 dates are within the same year, but seems to break if the end date is in the following year. Could anyone point me in the right direction as to why?</p>

<p>Both vars are date pickers in the format DD/MM/YYYY.</p>

<p>Thanks in advance. </p>

<pre><code>$(document).ready(function() {
    $("#start").change(  function() {   
        var startDate = $('#start').val().replace('/','');
        var endDate = $('#due').val().replace('/','');
        if(startDate &gt; endDate){
           $("#due").val($(this).val());
        }

    });
});
</code></pre>
