Moment.js vs native date (v2)

Revision 2 of this benchmark created by Victor on


Preparation HTML

<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.7.0/moment.min.js"></script>

Setup

var getStartOfTheDay = function() {
      var start = new Date();
      start.setHours(0);
      start.setMinutes(0);
      start.setSeconds(0);
      start.setMilliseconds(0);
      return new Date();
    }

Test runner

Ready to run.

Testing in
TestOps/sec
Moment.js Library
var start = moment().startOf('day').toDate();
 
ready
Native Date
var start = getStartOfTheDay();
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by Montana Flynn on
  • Revision 2: published by Victor on