Date formatting

Benchmark created on


Setup

const formatter3 = new Intl.DateTimeFormat({
	hour: 'numeric',
	minute: '2-digit',
});

Test runner

Ready to run.

Testing in
TestOps/sec
toLocaleTimeString directly with options
const time = new Date().toLocaleTimeString(undefined, {
	hour: 'numeric',
	minute: '2-digit',
});
ready
toLocaleTimeString directly without options
const time = new Date().toLocaleTimeString();
ready
Intl.DateTimeFormatter without caching
const time = new Intl.DateTimeFormat({
	hour: 'numeric',
	minute: '2-digit',
}).format(new Date())
ready
Intl.DateTimeFormatter with caching
formatter3.format(new Date());
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.