title: How to compare two datepicker dates using jQuery
body: <p>This is my code:</p>
  <pre><code>var $from = $(&quot;#fromDate&quot;).datepicker('getDate');
  var $to = $(&quot;#toDate&quot;).datepicker('getDate');
  if($from &gt; $to)
     alert(&quot;from date shouldn't greater than To date&quot;);
  </code></pre>
  <p>It is working if it is two dates in the same year. Otherwise, for example
  fromDate='1/12/2012'(dd/mm/yyyy) toDate='18/6/2013'(dd/mm/yyyy), while you check the condition, it is not working. It throws an alert, which is given.</p>