JSFiddle - React, Tailwind, and code Playground
by TrueBlueAussie
HTML
<label>month</label>
<input type="text" id="month"></input>
<label>year</label>
<input type="text" id="year"></input>
<button id="calculateDays">calculate days</button>
JavaScript
function getDaysInMonth(m, y) { //TrueBlueAussie
return m===2?y&3||!(y%25)&&y&15?28:29:30+(m+(m>>3)&1);
}
document.getElementById("calculateDays").onclick = function () {
console.log(
getDaysInMonth(
document.getElementById("month").value,
document.getElementById("year").value));
}