title: How to get first and last day of the week with Moment.js?
body: <p>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?</p>
  
  <p>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.</p>
  
  <p>I read the documentation <a href="https://momentjs.com/docs/" rel="noreferrer">https://momentjs.com/docs/</a> and I found the <strong>weekday ()</strong> 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?</p>
  
  <p>I need this to filter the data of an Observable according to the period: Month, Week ...</p>
  
  <pre><code>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) =&gt; {
  
      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;
      }
    });
  </code></pre>