I’m using the email action to send an email to users. In it I’m trying to output the date and time in the nl-NL
locale using toLocaleDateString
and toLocaleTimeString
.
Prototyping in the Chrome Developer Console, the following code works and gives me the Dutch formatted date and time. However, when using the email action, it seems to default to an English/American locale like this: “Wednesday, February 5, 2025 om 03:00 PM”
{!AfspraakDatum!}
<%
const afspraakdatum = new Date(Entity.AfspraakDatum);
const afspraakDag = afspraakdatum.toLocaleDateString('nl-NL', {timeZone: 'Europe/Amsterdam', weekday: 'long', year: 'numeric', month: 'numeric', day: 'numeric'});
const afspraakTijd = afspraakdatum.toLocaleTimeString('nl-NL', { timeZone: 'Europe/Amsterdam', hour: '2-digit', minute: '2-digit', hour12: false });
%>
<%= afspraakDag %> om <%= afspraakTijd %>
Am I doing something wrong?