JSFiddle - React, Tailwind, and code Playground
by princeofabyss
JavaScript
var lastDateOfMonth = function(year, month, day) {
return day <= 15 ? new Date(year, month, 0).toLocaleDateString('el-GR') : new Date(year, month + 1, 0).toLocaleDateString('el-GR');
}
const thisYear = new Date().getFullYear();
const thisMonth = new Date().getMonth();
const thisDay = 14; //new Date().getDate();
for (let step = 1; step <= 12; step++) {
console.log(lastDateOfMonth(thisYear, thisMonth + step, thisDay));
}