Skip to Main Content

Locale at midnight

Info

Different browsers may have different interpretations of "locale" in Javascript, for example when using toLocaleString.

In the example above - at the time of writing anyway (March 2021) - I got these results:
Both Edge and Chrome returned "en = 24:00", while Firefox returned "en = 00:00".
All three returned "en-GB = 0:00".

I say "at the time of writing" because I'm 100% sure that Chrome returned "en = 00:00" until a while ago...
The change in behavior became apparent in code that had been working fine for about 2 years, but was now broken because of this. Switching to "en-GB" solved the issue on all browsers. Until the next update, anyway...

Code

Region

Identification
Sequence
Title
Type
Source
Source Type
Region Source