Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Date JS VS Date-Fns VS MomentJS - differenceInSeconds
(version: 1)
Comparing performance of:
Date JS vs Date-Fns vs MomentJS
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:
var unix = 1724409214;
Tests:
Date JS
const keyEffectiveDateStart = new Date('2025-07-21T11:42:05.322Z'); const keyEffectiveDateEnd = new Date('2025-07-21T12:35:01.233Z'); const secondsTillKeyEnd = (keyEffectiveDateEnd.getTime() - keyEffectiveDateStart.getTime()) / 1000;
Date-Fns
const keyEffectiveDateStart = new Date('2025-07-21T11:42:05.322Z'); const keyEffectiveDateEnd = new Date('2025-07-21T12:35:01.233Z'); const secondsTillKeyEnd = dateFns.differenceInSeconds(keyEffectiveDateEnd, keyEffectiveDateStart);
MomentJS
const keyEffectiveDateStart = moment.utc('2025-07-21T11:42:05.322Z'); const keyEffectiveDateEnd = moment.utc('2025-07-21T12:35:01.233Z'); const secondsTillKeyEnd = keyEffectiveDateEnd.diff(keyEffectiveDateStart, 'seconds');
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Date JS
Date-Fns
MomentJS
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
6 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36
Browser/OS:
Chrome 141 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Date JS
3396504.5 Ops/sec
Date-Fns
2242568.8 Ops/sec
MomentJS
123466.9 Ops/sec
Related benchmarks:
Date vs moment with compare
MomentJS VS Date
MomentJS VS Date - getTtlFromKey
MomentJS VS Date VS Date-Fns - getRoundedDate
MomentJS VS Date VS Date-Fns - ttlSec
MomentJS VS Date VS Date-Fns - getTtlFromKey
MomentJS VS Date VS Date-Fns - getRoundedDate #2
Date JS VS Date-Fns - differenceInSeconds
Date JS VS Date-Fns VS MomentJS - startOfDay
Comments
Confirm delete:
Do you really want to delete benchmark?