html date min today

Solutions on MaxInterview for html date min today by the best coders in the world

showing results for - "html date min today"
Zachery
18 Oct 2016
1var today = new Date();
2var dd = today.getDate();
3var mm = today.getMonth()+1; //January is 0!
4var yyyy = today.getFullYear();
5 if(dd<10){
6        dd='0'+dd
7    } 
8    if(mm<10){
9        mm='0'+mm
10    } 
11
12today = yyyy+'-'+mm+'-'+dd;
13document.getElementById("datefield").setAttribute("max", today);
14