momentjs vs datejs (v22)

Revision 22 of this benchmark created on


Description

moment.js and date.js are 2 libraries offering similar functionalities that is lacking in basic javascript.

Results on Chrome: moment.js is lighter, and offers much faster parsing. On the other hand, date.js offers much faster formatting and manipulation.

Preparation HTML

<script src="http://datejs.googlecode.com/files/date.js"></script>
<script src="http://momentjs.com/downloads/moment.min.js"></script>
<script>
  var DateJS = new Date();
  var momentJS = moment();
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
moment.js parse
moment('07-10-1986', 'MM-DD-YYYY');
ready
DateJS parse
Date.parse('07-10-1986', "MM-dd-yyyy");
ready
moment.js format
momentJS.format('MM-DD-YYYY h:mm:ss a');
ready
DateJS format
DateJS.toString('MM-dd-yyyy h:mm:ss t');
ready
moment.js manipulation
momentJS.add({ days: 5, months: 3 });
ready
DateJS manipulation
DateJS.add({ days: 5, months: 3 });
ready
moment.js Overall
moment('07-10-1986', 'MM-DD-YYYY').add({ days: 5 }).format('MM-DD-YYYY h:mm:ss a');
ready
DateJS Overall
Date.parse('07-10-1986', "MM-dd-yyyy").add({ days: 5 }).toString('MM-dd-yyyy h:mm:ss t');
ready
Moment ISO
moment([1986, 07, 10]);
ready

Revisions

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