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 (X11; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0
Browser:
Firefox 121
Operating system:
Linux
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
moment
194329.6 Ops/sec
date-fns
272603.4 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');