JSFiddle - React, Tailwind, and code Playground

by Khanh Le

HTML

<input id="datefield" type='date' min="2022-05-31" />

JavaScript

var today = new Date().toLocaleDateString('en-ZA');
console.log(today)
/* document.getElementById("datefield").setAttribute("min", today); */
// console.log(new Date().toLocaleDateString('en-ZA'));
/* var dd = today.getDate();
var mm = today.getMonth() + 1; //January is 0!
var yyyy = today.getFullYear();



today = yyyy+'-'+mm+'-'+dd;
console.log(today)
document.getElementById("datefield").setAttribute("min", today);

 */