Is there a way to retrieve the date of the first day of the week and the date of the last day of the week using Moment.js?
I am looking to fetch the dates from the start of the week until the end of the current week based on the current day in Moment.js.
Although I came across the weekday() function in the documentation at https://momentjs.com/docs/, I still need assistance in obtaining the first and last days of the week according to the current date using Moment.js. How can I achieve this?
This information is required for data filtering in an Observable based on different time periods such as Month, Week, etc.
var start_date = moment(this.start_date, 'DD/MM/YYYY').format('YYYY-MM-DD')
var final_date = moment(this.final_date, 'DD/MM/YYYY').format('YYYY-MM-DD')
this.transacoesList = this.transacoesList
.filter((v) => {
var release_date = moment(v.release_date, 'DD-MM-YYYY').format('YYYY-MM-DD');
if (moment(release_date).isBetween(start_date, final_date, null, '[]')) {
return true;
}
});