Test name | Executions per second |
---|---|
moment | 250810.5 Ops/sec |
date-fns | 199598.8 Ops/sec |
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/date-fns/1.30.1/date_fns.min.js"></script>
window.__date__ = new Date();
window.__expected__ = '2000/01/06';
var actual = moment(__date__).format('YYYY/MM/DD');
console.assert(actual === __expected__);
var actual = dateFns.format(__date__, 'YYYY/MM/DD');
console.assert(actual === __expected__);