Answers for "input type=date min today"

9

html input date min

<label for="meeting">Next meeting (August 2021):</label>
<input type="date" 
       id="meeting" 
       name="meeting"
       min="2021-08-01" 
       max="2021-08-31"
       defaultValue="2021-08-01">
Posted by: Guest on March-20-2021
1

html add mindate to datetime-local picker

<form>
    <label for="party">Enter a date and time for your party booking:</label>
    <input id="party" type="datetime-local" name="partydate" min="2017-06-01T08:30" max="2017-06-30T16:30">
  </form>
Posted by: Guest on July-29-2020
1

set min date field to current date

// Use Javascript
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0 so need to add 1 to make it 1!
var yyyy = today.getFullYear();
if(dd<10){
  dd='0'+dd
} 
if(mm<10){
  mm='0'+mm
} 

today = yyyy+'-'+mm+'-'+dd;
document.getElementById("datefield").setAttribute("min", today);
Posted by: Guest on June-02-2020

Browse Popular Code Answers by Language