var date = new Date();
var firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
var lastDay = new Date(date.getFullYear(), date.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 ...
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);