24hr format instead of AM/PM in Europe

Go to the page JavaScript Tester online
and enter:

alert(new Date().toLocaleTimeString());

click EXECUTE and what do you see?

1 Like

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 :slight_smile:

The log book is in 12 am/pm format in the left column of all rows. Bug :ant:

If I click on an item in the log book the pop-up is again in 24 hour which is OK. :slight_smile:

The history is in 24 hour format on the page. :slight_smile:

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. :ant:

Snapshot data is in 24 hour format :slight_smile:

Hass.io -> system log is in 24 hour format :slight_smile:

Developer tools states is all in 24 hour format - both attributes and pop-ups :slight_smile:
Also logs in the About screen are 24 hour format :slight_smile:

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 :ant: 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)

4 Likes

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. :stuck_out_tongue:

Info page log is in 12 hour :ant:

The raw log below is in 24 hour :slight_smile:

All is exactly the same on a Linux client machine. Exact same behavior.

I have created a Github bug report at https://github.com/home-assistant/home-assistant-polymer/issues/3332

3 Likes

So I had this problem as well. Until I was smart enough to check what language I actually had set in Home Assistant on my account. So English seems to be English US as it uses 12h clock in Logbook and History page. But Swedish uses 24h clock there.

So I guess problem would be solved if there was a English (UK) option?

No it’s not solved. If i set it to “German” it still shows am/pm if connected through an english browser.

3 Likes

So? There is still no fix for this?

Please fix - Or change default to ISO / Metric systems, and let the people with 3 fingers on hands and feet, 12 in total (victims of imperial system - 12 inches = 1 foot. 3 feet = 1 yard), be the ones that has to struggle to get it right.

3 Likes

Solution for making 24h even though HA UI language is English - Simply add language line in Card define:

Setting time format per card is not very practical.
Eg mini-graph-card has no problems to show 24h format no matter of the used browser or settings of.
So it should be possible to make HA ALL 24h or am/pm, I just guess that most of the developers are using am/pm and are not interested in making the (big) change.

2 Likes

Wow.

New to the community (installed Home Assistant (formerly known as Hass.io :wink: ) yesterday). This is my first post.

More business oriented that technical, but with what I would consider above average programming skills for a non-programmer, I struggle to get the application to behave the way I want. :slightly_smiling_face:

This thread, however, was not very encouraging.

I have full respect for the fact that it may be a large programming effort to be able control the date and time format from within the app, but, also with all due respect, the fact that this is not already built into the system is a huge design flaw!

The discussion above just proves that this should be viewed from and end user perspective, and not from a technical perspective. We could argue for months (actually, the discussion in this thread has been going on for almost two years…) about whether the setting is retrieved from the browser or the OS*, but the fact remains that even though it is very fancy to retrieve settings from the underlying system, it should really be possible to override in the application.

The use cases are numerous in the thread above; some people don’t get to decide the language of their OS or browser, some have other reasons for running the OS or browser with this or that language or regional setting, but they still want to be able to have date and time displayed the way in which they are used to. There could even be cases where you want one date/time format in one app, because that’s what you use when you talk to your American customers or co-workers, and other date/time formats in another apps, because you use that with your European colleagues or that’s what you’re used to from childhood or whatever.

I recently had a lengthy discussion with one of the larger Swedish banks about their app, which originally was only available in Swedish, but when they added an English version, the language was automatically set by the language of the OS. This was extremely frustrating, since I am very used to running the OS in English (always have, always will, partly due to the fact that some terms are poorly translated or sounds strange since the OS in most cases is originally created in English) but the bank app in Swedish (partly because some of the English translations within the bank app were really, really bad). After a very long and exhausting discussion they finally changed** so that the OS language was default, but it was possible to change to your preferred language within the app.

And this is exactly what should be the standard in every app out there. When it comes to languages and regional settings, retrieve whatever you want from the underlying system (browser, OS, whatever) but make it possible to override it in the app.

And I’m not even getting into the whole “ISO is the only correct way to display date and time”, because I don’t want to start a religious war (even though ISO is the correct way… :wink: ). For most Europeans 24h presentation of time is the natural thing, for most people in the US 12h presentation of time comes natural. Regardless of what language you have in your OS or browser.

I really hope that this gets fixed. It’s not a deal breaker, but it’s definitely something that diminishes my enthusiasm…

*) As for me, in Sweden with US English Windows, the time format changes from 12h to 24h when I change the primary display language in my Chrome browser. Others in the thread have argued that you have to change a setting in the OS, but for me that is simply not true. For others it may be. Which just further proves my point…

**) I’m not saying I was the one who single-handledly got them to do it, but I hope my opinion (and nagging…) played at least some part.

15 Likes