Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36
Chrome 110
Windows
Desktop
one year ago
Test name Executions per second
moment 297757.0 Ops/sec
date-fns 274950.3 Ops/sec
HTML Preparation code:
x
 
1
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
2
<script src="https://cdnjs.cloudflare.com/ajax/libs/date-fns/1.30.1/date_fns.min.js"></script>
3
Script Preparation code:
 
window.__date__ = new Date();
window.__expected__ = '2021/09/26';
Tests:
  • moment

     
    const actual = moment(__date__).format('DD/MM/YYYY hh:mm A');
    const actual2 = moment(__date__).format("hh:mm A");
  • date-fns

     
    const actual = dateFns.format(__date__, 'DD/MM/YYYY hh:mm A');
    const actual2 = dateFns.format(__date__, 'hh:mm A');