title: Get first day of week by date
body: <p>I'm trying to get the first day of the week by date,</p>
  
  <p>This code </p>
  
  <pre><code>  var firstDayOfWeek = new Date(now.setDate(now.getDate() - now.getDay()+1));
  </code></pre>
  
  <p>returns </p>
  
  <blockquote>
    <p>Mon Oct 29 2018 17:50:02 GMT+0000 (Greenwich Mean Time)</p>
  </blockquote>
  
  <p>How do I just get the date in the following format.</p>
  
  <p>YYYY-MM-DD</p>