Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Date JS VS MomentJS VS Date-Fns - isValid
(version: 1)
Comparing performance of:
Date JS vs MomentJS vs Date-Fns
Created:
9 months ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/moment@2.29.4/moment.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/date-fns/cdn.min.js"></script>
Script Preparation code:
const isoDateFormatRegExp = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
Tests:
Date JS
const dateString = new Date().toISOString(); let isValid; if (!isoDateFormatRegExp.test(dateString)) { isValid = false; } isValid = !isNaN(new Date(dateString).getTime());
MomentJS
const isValid = moment(new Date().toISOString(), 'YYYY-MM-DDTHH:mm:ss.SSSZ', true).isValid();
Date-Fns
const dateString = new Date().toISOString(); const isValid = dateFns.isValid(dateFns.parseISO(dateString));
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Date JS
MomentJS
Date-Fns
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
9 months ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Browser/OS:
Chrome 137 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Date JS
872294.1 Ops/sec
MomentJS
115006.2 Ops/sec
Date-Fns
344609.3 Ops/sec
Related benchmarks:
date-fns vs moment addDays
MomentJS VS Date
MomentJS VS Date - ttlSec
MomentJS VS Date VS Date-Fns - getRoundedDate
MomentJS VS Date VS Date-Fns - ttlSec
MomentJS VS Date VS Date-Fns - getRoundedDate #2
Date JS VS Date-Fns - startOfDay
Date JS VS MomentJS - isValid
Date JS VS Date-Fns VS MomentJS - startOfDay
Comments
Confirm delete:
Do you really want to delete benchmark?