Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
JS Date libraries 3
(version: 3)
Comparing performance of:
luxon vs dayjs vs vanilla
Created:
one year ago
by:
Registered User
Jump to the latest result
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/luxon@1.26.0/build/global/luxon.min.js"></script> <script src="https://unpkg.com/dayjs@1.8.21/dayjs.min.js"></script> <script src="https://unpkg.com/dayjs@1.8.21/plugin/isBetween.js"></script>
Script Preparation code:
dayjs.extend(window.dayjs_plugin_isBetween) window.__date__ = new Date('2000-01-06T03:24:11'); window.__another_date__ = new Date('2000-01-30T03:24:11'); window.__another_month__ = new Date('2000-02-01T00:00:00'); window.__another_year__ = new Date('1999-01-06T03:24:11'); window.__saturday__ = new Date('2021-05-01T03:24:11'); window.__sunday__ = new Date('2021-05-02T03:24:11'); window._expected_string = '2000/01/06'; window._expected_start = '2000/01/01'; window._expected_end = '2000/01/31'; window._expected_day_of_week = 1; window.unix = (date) => { return date.valueOf() / 1000; } window.diffDate = (date1, date2, unit) => { const date1Unix = unix(date1); const date2Unix = unix(date2); switch (unit) { case "minute": return (date1Unix - date2Unix) / 60; case "hour": return (date1Unix - date2Unix) / 3600; case "day": return (date1Unix - date2Unix) / 86400; case "week": return (date1Unix - date2Unix) / 604800; } }
Tests:
luxon
var date1 = luxon.DateTime.fromJSDate(__date__); var date2 = luxon.DateTime.fromJSDate(__another_date__); date1.diff(date2, "minute"); date1.diff(date2, "hour"); date1.diff(date2, "day"); date1.diff(date2, "week");
dayjs
var date1 = dayjs(__date__); var date2 = dayjs(__another_date__); date1.diff(date2, "minute"); date1.diff(date2, "hour"); date1.diff(date2, "day"); date1.diff(date2, "week");
vanilla
var date1 = __date__; var date2 = __another_date__; diffDate(date1, date2, "minute"); diffDate(date1, date2, "hour"); diffDate(date1, date2, "day"); diffDate(date1, date2, "week");
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
luxon
dayjs
vanilla
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
5 months ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36
Browser/OS:
Chrome 142 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
luxon
42166.5 Ops/sec
dayjs
45296.0 Ops/sec
vanilla
26534332.0 Ops/sec
Related benchmarks:
JS Date libraries 2
Date libraries benchmark JS 1
Dayjs Date-fns format comparison 4
Dayjs Date-fns format comparison 5
Dayjs Date-fns format comparison 6
JS Date libraries 2023.0
JS Date libraries 2 fixed
dayjs vs luxon timeToEnd
dayjs vs luxon between
Comments
Confirm delete:
Do you really want to delete benchmark?