Sample Header Ad - 728x90

Why don't browsers respect LC_TIME?

5 votes
1 answer
560 views
I'm using en_US for system language, but pl_PL for date format. It works OK in the entire system, and running date gives me a correctly formatted date. It also shows Polish as Time format in the GUI Language Settings. But in any browser (Chrome, Chromium, Firefox) I have US format! For example in Date input, Date in JS etc... console.log(new Date().toLocaleString()) // shows 9/26/2021, 3:29:46 PM // should be 26.09.2021, 15:29:46 locale: LANG=en_US.UTF-8 LANGUAGE=en_US LC_CTYPE="en_US.UTF-8" LC_NUMERIC=pl_PL.UTF-8 LC_TIME=pl_PL.UTF-8 LC_COLLATE="en_US.UTF-8" LC_MONETARY=pl_PL.UTF-8 LC_MESSAGES="en_US.UTF-8" LC_PAPER=pl_PL.UTF-8 LC_NAME=pl_PL.UTF-8 LC_ADDRESS=pl_PL.UTF-8 LC_TELEPHONE=pl_PL.UTF-8 LC_MEASUREMENT=pl_PL.UTF-8 LC_IDENTIFICATION=pl_PL.UTF-8 LC_ALL= To reproduce this use: https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_tolocalestring , or create a file called index.html with the following contents:
Hi!
    
     console.log(new Date().toLocaleString())
And then open this file using any value of LC_ALL and browser combination you care to try:
LC_ALL=el_GR.utf8 firefox index.html
Then, look at the javascript console (usually available by pressing F12) and you will see the date format ignores the LC setting. I also have en for language and pl for dates on a Windows machine and it works fine. Why can't Linux do this? I was dealing with this for year now. All I can find in google is people with similar issue but without solution or problems with date format in system. System: Linux Mint 20 Xfce
Asked by chojnicki (151 rep)
Sep 26, 2021, 02:23 PM
Last activity: Apr 22, 2025, 11:59 AM