brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: Intl.DateTimeFormat with dateStyle gives Dutch dates without a library

Web-Development
~/tips/tip-javascript-intl-datetimeformat-nl

// for example "28 november 2026 om 14:05"

Formats dates and times in Dutch or any locale with the built-in Intl object.

Showing a date in Dutch, with the month name in lowercase and the right order, is a good reason people install a date library. For plain display, Intl.DateTimeFormat in the browser already knows how. Living in Leiden, I care that dates read the Dutch way.

Pass a locale and one of the style shortcuts, dateStyle and timeStyle, which take full, long, medium or short:

const fmt = new Intl.DateTimeFormat("nl-NL", {
  dateStyle: "long",
  timeStyle: "short",
  timeZone: "Europe/Amsterdam",
});

fmt.format(new Date());
// for example "28 november 2026 om 14:05"

The exact words and punctuation come from the locale data of the browser or Node build, so the output can differ slightly between environments. That is a good reason to show the result to a Dutch reader rather than parse it back.

The timeZone option takes IANA names like Europe/Amsterdam, which is handy when a server runs in UTC and you still want the time as people in the Netherlands read it. Without it the runtime’s own time zone is used.

The main caveat: dateStyle and timeStyle cannot be mixed with single options such as month, day or hour. Mixing them throws a TypeError. If you need a custom shape, use the single options only:

new Intl.DateTimeFormat("nl-NL", {
  weekday: "long", day: "numeric", month: "long",
}).format(new Date());

Create the formatter once and reuse it when you format many dates in a loop, since building one is the slower part.

Further reading: MDN: Intl.DateTimeFormat

More Web-Development tips ab -n 200 -c 10 https://example.com/ console.assert(items.length > 0, 'cart is empty', items) document.designMode = "on" function save(item) { Save draft All Web-Development tips (67) All topics

Link