I have an array with all months and the number of the month, like this :
months = [
{ name: 'JANUARY', id: 0 },
{ name: 'FEBRUARY', id: 1 },
{ name: 'MARCH', id: 2 }
......
]
I have an array with all months and the number of the month, like this :
months = [
{ name: 'JANUARY', id: 0 },
{ name: 'FEBRUARY', id: 1 },
{ name: 'MARCH', id: 2 }
......
]
startAndEndOfSelectedMonth() {
let year = new Date().getFullYear();
let startDate = moment([year, this.month - 1]);
let endDate = moment(startDate).endOf('month');
return { start: startDate, end: endDate };
}
I think this similar post (sharing the link below) will help you for achieving your goal. Concept remains the same.
Link Get first and last date of current month with JavaScript or jQuery