Show time as 0:30:00 instead of 24:30:00 for English

Viewed 28

I have the following code to format dates with time. For some reason the English strings show times as 24:30:00 while the German one shows 00:30:00

Is there any way to make the English ones show 00:30:00 as well.

const options = {
  year: "numeric",
  month: "numeric",
  day: "numeric",
  hour12: false,
  timeZone: "UTC",
  hour: "numeric",
  minute: "numeric",
  second: "numeric",
} as Intl.DateTimeFormatOptions;

Intl.DateTimeFormat("en-En", options).format(new Date(1800000)); // '1/1/1970, 24:30:00'
Intl.DateTimeFormat("en-Au", options).format(new Date(1800000)); // '01/01/1970, 24:30:00'
Intl.DateTimeFormat("de-De", options).format(new Date(1800000)); // '1.1.1970, 00:30:00'
0 Answers
Related