JSFiddle - React, Tailwind, and code Playground
HTML
<div class="entry">
<label for="startDate">Start date:</label>
<input id="startDate" name="startDate" type="date">
</div>
JavaScript
function getTodaysDate(){
date = new Date();
day = date.getDate();
month = date.getMonth() + 1;
year = date.getFullYear();
if (month < 10) month = "0" + month;
if (day < 10) day = "0" + day;
today = year + "-" + month + "-" + day;
return today;
}
document.getElementById('startDate').setAttribute('max', getTodaysDate());