title: How to get the beginning and end of the day with moment?
body: <p>I would like to get the beginning and end of the current day (and accessorily of tomorrow by <code>.add(1, 'day')</code>) using <code>moment</code>.</p>
  
  <p>What I am getting now is </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>now = moment()
  console.log('now ' + now.toISOString())
  console.log('start ' + now.startOf('day').toISOString())
  console.log('end ' + now.endOf('day').toISOString())</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>This outputs right now </p>
  
  <pre><code>now 2018-04-18T21:20:02.010Z
  start 2018-04-17T23:00:00.000Z
  end 2018-04-18T22:59:59.999Z
  </code></pre>
  
  <p>Since the times are shifted by an hour, I believe that this is something related to timezones, though I fail to understand how this can be relevant: no matter the time zone, the day in that timezone begins right after midnight today and ends right before midnight today.</p>