Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
date-fns vs momentjs date formatting
It's not a deep validation; I'm just comparing ONE function that those two libraries have in common.
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Browser:
Chrome 120
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
moment
305359.0 Ops/sec
date-fns
252938.6 Ops/sec
HTML Preparation code:
<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>
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');