title: Problem when compare 2 dates in javascript
body: <p>i have 1 problem, i wanna compare two dates between date born and today, the condition is date born must be less than today date, it worked at first, but if i pick another date from datepicker which is less than today, its still pop up alert. And it not ok. Anyone know why this this happened?</p>
  <pre><code>    function submitForm() {
          
          var dateborn = document.getElementById('dateborn').value;   
          var today = document.getElementById('today').value;
          
          if(dateborn != '')
          {           
              if(dateborn &gt; today)
              {
              swal(&quot;Oops&quot;, &quot;Date born must less than date today&quot;, &quot;error&quot;);       
              return false;
              }
          }
  
              
      }
  </code></pre>