JSFiddle - React, Tailwind, and code Playground
JavaScript
var currentDate = new Date(2018, 2, 4);
function getDaysInMonth(month, year) {
var date = new Date(year, month, 1);
var days = [];
while (date.getMonth() === month) {
days.push(new Date(date));
date.setDate(date.getDate() + 1);
}
return days;
}