Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Date.toLocaleDateString vs dayjs vs luxon vs custom
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Browser:
Chrome 127
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Date.toLocaleDateString
17387.1 Ops/sec
luxon
7071.2 Ops/sec
dayjs
395569.9 Ops/sec
custom
1711681.0 Ops/sec
HTML Preparation code:
<script src=" https://cdn.jsdelivr.net/npm/dayjs@1.11.10/dayjs.min.js "></script> <script src="https://cdn.jsdelivr.net/npm/dayjs@1.11.10/locale/ru.js"></script> <script src=" https://cdn.jsdelivr.net/npm/luxon@3.4.4/build/global/luxon.min.js "></script>
Script Preparation code:
var DATE_STR = "2024-01-01T01:01:01.001Z"; var MONTH_NAMES = [ "января", "февраля", "марта", "апреля", "мая", "июня", "июля", "августа", "сентября", "октября", "ноября", "декабря" ]; function formatDateRead(date) { return `${date.getDate().toString()} ${MONTH_NAMES[date.getMonth()]} ${date.getFullYear()}`; }
Tests:
Date.toLocaleDateString
new Date(DATE_STR).toLocaleDateString('ru-RU', { day: 'numeric', month: 'long', year: 'numeric', }).slice(0, -3);
luxon
luxon.DateTime.fromISO(DATE_STR).setLocale("ru").toFormat('d MMMM yyyy');
dayjs
dayjs(DATE_STR).locale('ru').format('D MMMM YYYY');
custom
formatDateRead(new Date(DATE_STR));