How do I get the date of the first day of the week and the date of the last day of the week with Moment.js?
I need to get the date from the first day of the week to the date of the last day of the current week that I'm basing on the current day.
I read the documentation https://momentjs.com/docs/ and I found the weekday () function, but I need to get the first day of the week and the last day of the week based on the current date, how do I do this using Moment?
I need this to filter the data of an Observable according to the period: Month, Week ...
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;
}
});