var date = new Date();
var firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0);
var today = new Date();
var lastDayOfMonth = new Date(today.getFullYear(), today.getMonth()+1, 0);
const firstDay = new Date(now.getFullYear(), now.getMonth(), 1);
console.log(firstDay); // Sat Oct 01 2022 ...
const lastDay = new Date(now.getFullYear(), now.getMonth() + 1, 0);
console.log(lastDay); // Mon Oct 31 2022 ...
let today = new Date();
let lastDayOfMonth = new Date(today.getFullYear(), today.getMonth()+1, 0);
let numberOfDays = lastDayOfMonth.getDate();
let today = new Date();
let lastDayOfMonth = new Date(today.getFullYear(), today.getMonth()+1, 0);
let numberOfDays = lastDayOfMonth.getDate();
var date = new Date(), y = date.getFullYear(), m = date.getMonth();
var firstDay = new Date(y, m, 1);
var lastDay = new Date(y, m + 1, 0);
var d = new Date();
d.setDate(0); //sets d to the last day of the previous month
d.setDate(1); //sets d the the first day of that month
d.setHours(0,0,0,0); //sets d time to midnight
//d now equals the first day of the month before today