How to get the beginning and end of the day with moment?

It is giving you midnight local time, but you're printing it out in zulu time. Try using toString instead, it will print the time out in local time.

now = moment()
console.log('now ' + now.toString())
console.log('start ' + now.startOf('day').toString())
console.log('end ' + now.endOf('day').toString())
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.1/moment.js"></script>