title: How do I restrict past dates in HTML5 input type Date?
body: <p>I am trying to restrict past dates in <code>input type=&quot;date&quot;</code>. I am able to restrict future dates, but how can I restrict past dates?</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(function(){
      var dtToday = new Date();
  
      var month = dtToday.getMonth() + 1;
      var day = dtToday.getDate();
      var year = dtToday.getFullYear();
      if(month &lt; 10)
          month = '0' + month.toString();
      if(day &lt; 10)
          day = '0' + day.toString();
  
      var minDate= year + '-' + month + '-' + day;
  
      $('#txtDate').attr('min', minDate);
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;input type="date" id="txtDate" /&gt;</code></pre>
  </div>
  </div>
  </p>