var date = new Date();
var firstDay = new Date(date.getFullYear(), date.getMonth(), 1);
var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0);
// Make an instance or object of the Date constructor
const currentDate = new Date();
// get the current month number
const monthNumber = currentDate.getMonth();
console.log(monthNumber); // eg: 8
//Get full month from date javascript
const date = new Date(2009, 10, 10); // 2009-11-10
const month = date.toLocaleString('default', { month: 'long' });
console.log("Result - ", month); // Result - November
const moment = require('moment');
let year = '2022';
let month = '2';
let startDate = moment([year, month - 1]);
let endDate = moment(startDate).endOf('month');
console.log(startDate, endDate);