Don’t waste your breath. I’ve tried explaining this many times over and everyone screams bug. Location & Language drive it all.
The bug is that people don’t know what happens. If HA would display the LANG setting of the system, then people know why the time format is american. And there could be a warning if the local setting in the backend (=HA) is different then that from the browser.
It just doesn’t make any sense to make the backend decide which language and time format to use. My company PC has a company managed image, and it’s US English. I can’t change that. My iphone is my personal device, but i still got it set to English as it makes more sense to me (but both devices show the correct currency, date & time). But some other devices in my house are German. And i prefer English as main language for HA, but still want to see my date/time in 24h format. The way it is now is just not user oriented.
We talk about this for literally YEARS now, and to me it seems this issue is not even IGNORED offcially. This is sad.
The decision about AM/PM is made by javascript in the browser. So it is decided in the front end. If your frontend is set to american english, you see AMPM, if you set your front end to british english, you see 24 hour clock.
There is no british english setting in 0.95.4
Frontend. Not backend. It’s the browser where it has to be set, but it’s been reported several times that
a) this doesn’t work 100% of the time
b) it’s not practible as you may not want to change it, or are not allowed to (policies)
So there should be a setting in HA directly where this can be set, and that should be used be the browser.
Is is NOT the browser preferred language for websites. It is the locale language of the system which is used by the javascript engine to format time values or the language setting for the browser menus.
Go to the page JavaScript Tester online
and enter:
alert(new Date().toLocaleTimeString());
click EXECUTE and check. What do you see?
It’s almost like there is something wrong in the code. Maybe it’s a special feature? It’s not a bug after all because people say so.
Go to the page JavaScript Tester online
and enter:
alert(new Date().toLocaleTimeString());
click EXECUTE and what do you see?
Results of my test with alert(new Date().toLocaleTimeString());
Firefox on Ubuntu: Firefox > Preferences > Languages: English(Canada)
Javascript test reports time in 12-hour format (AM/PM).
Change to Firefox > Preferences > Languages: English(United Kingdom)
Javascript test reports time in 24-hour format.
You do realize that the javascript developer console is in fact the same thing? There’s no different “context” or something like that just by throwing it into a textbox and calling eval.
Taras you changed the menu language in firefox, this has also an effect on the JS engine.
Wasn’t it the point of the exercise? To show that the browser’s settings can influence the time’s appearance. Ubuntu’s locale setting remained unchanged throughout but tweaking the browser’s language setting altered how time is displayed within it.
Or was the exercise meant to serve another purpose?
I have the OS set to en-GB and the browser to en-GB and that makes half of HA in 24.
But the other half is not. The 12 hour pops up everywhere. I have just walked through my own HA. It is using Google Chrome on a Windows 10 machine with OS set to British English. I get similar results on Google Chrome on a Linux box with the OS set to en-GB.
On the various tabs in the Overview, the small pop-up you get when you click on a badge or entity is in 24 hour clock. OK
The log book is in 12 am/pm format in the left column of all rows. Bug
If I click on an item in the log book the pop-up is again in 24 hour which is OK.
The history is in 24 hour format on the page.
But if you hover over the items on the history items with the mouse pointer where you see when states changed value you get the time in 12 hour am/pm.
Snapshot data is in 24 hour format
Hass.io -> system log is in 24 hour format
Developer tools states is all in 24 hour format - both attributes and pop-ups
Also logs in the About screen are 24 hour format
Now we can discuss back and forth if the front end should be coded to follow browser or a setting from the backend. In most cases for normal users following the browser is probably fine. It is us geeks that love to have English OS with 24 hour brains that need to have the trouble to change from US to UK.
But the bugs are objectively bugs in the front end where the devs have missed to use the correct code to get proper time format. And that is as I can find it only two places.
Log book list left column and hover over on history bars. Those are the two bugs. Do we have Github bugs already for these or should I create them? (I am at work and ran out of time right now to check now)
the PR’s probably don’t exist for those. I’d write them up with all the information in this post. I wouldn’t even write up separate PRs. Just 1 pr with both issues.
When I come home in about 3 hours I will walk through the same with a browser on a Linux box to make sure the observations are the same. I think they are but I want to make sure we have the complete overview.
Yep, seems like you have a good handle on the issue. I’m using 12hr format and everything looks good on my end. Don’t see any 24hr formats. EDIT: All logs are 24 hr format it looks. I’d leave them out. They are just text files anyways.
check the logs on the info page. That would be another interface time
Stole from more minutes of work time. I tried with Firefox under Windows 10.
It shows all in 12 hour format UNTIL you also change language in the browser settings inside Firefox. So it is also browser dependent. To be sure both browser AND OS language settings are set to your desired locale. So some of the observations from earlier in this thread are both true and false. It is both browser and OS depending so when people ask remember to tell them to change it both places and remind that there are a few bugs in places.
So I thought. What about the 0.01% of you using Edge? I tried that too. Edge follows the Windows language.
So what about Internet Explorer? I did not try. You deserve to get the time in Klingon 34.5 hour format if you still use IE.