Even though I disliked Moment.js API, there wasn't an alternative, so I stuck to it. At some point, it became a performance bottleneck in out code I decided that enough is enough and started replacing Moment.js with custom code.
I wrote and published the very first function startOfDay
: https://github.com/date-fns/date-fns/commit/ad86a46a059d4baa178aa85d040aa4bd13430749