title: Javascript:Dates comparison
body: <pre><code>&lt;script&gt;  
    dfrom = datefrom.split("/");
      dto = dateto.split("/");
  
       //Checking Year Part;
       if(parseInt(dfrom[2]) &gt; parseInt(dto[2])){
        alert("DateFrom Cannot greater than DateTo");
        return false;
       }
       if((parseInt(dfrom[1]) &gt; parseInt(dto[1])) &amp;&amp; parseInt(dfrom[2]) == parseInt(dto[2])){
        alert("DateFrom Cannot greater than DateTo");
        return false;
       }
       if(parseInt(dfrom[0]) &gt; parseInt(dto[0]) &amp;&amp; (parseInt(dfrom[1]) == parseInt(dto[1])) &amp;&amp;    parseInt(dfrom[2]) == parseInt(dto[2])){
        alert("DateFrom Cannot greater than DateTo");
        return false;
       }
  &lt;/script&gt;
  </code></pre>
  
  <p>This is my script code to compare dates and is working fine but when I check 07/04/2013 and 08/04/2013, it shows "<strong>DateFrom Cannot greater than DateTo</strong>" and only these dates are showing wrong result. Is any error in my script or something else?</p>
  
  <p>Any help would be highly appreciable.</p>