New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent use of time formatting #184
Comments
The logbook and rising message in the sun card are actually being rendered using browser locale aware formatting. So for you seeing the AM/PM times means that is what your browser prefers. You can check your browser settings using these instructions. That being said, you're right that it is still inconsistent. It looks like I have hard coded the history to support the 24h system instead of being locale aware. |
I've digged into it a bit, and don't you need to specify the current locate to the moment library? It seems to be using LT what is the shortcode for locale aware time, but by default moment is using english. window.hass.uiUtil.formatTime = function(dateObj) {
return moment(dateObj).format('LT');
}; |
Ah dang, it seems like you're right. If only Apple would implement toLocaleDateString and toLocaleTimeString, it would make our lives so much easier. |
Still present as of 0.20.x |
Is this still a thing? |
Yep, still the same. |
I think moment.js could handle this. But I don't think we want add a new dependency. |
AFAIK, moment is already a dependency. Check my comment above. It just isn't initialised correctly. |
We removed moment, it is way too big for what it does. We use JavaScript On Wed, Oct 26, 2016 at 10:38 PM, Michaël Arnauts notifications@github.com
PaulusSchoutsen.nl |
Okay, I didn't know that. |
The times in the graphs are configured in a different way however. |
Is there any Polyfill? |
There seems to be a different implementation between browsers.
Firefox: > navigator.language
"nl"
> navigator.languages
Array [ "nl", "en", "en-US" ] Chrome: > navigator.language
"en-US"
> navigator.languages
["nl", "en", "en-US"] A more general solution could be to use the following line instead of just language = navigator.languages ? navigator.languages[0] : navigator.language || navigator.userLanguage; This picks the first selected language in your settings, and fallbacks to What do you think? |
According to this page, IE returns the language of the Operating System, what also don't accurately describe the time formatting requested. Someway, it doesn't feel right to depend the time formatting on the language of the operating system or browser installed. I think a lot of installed browsers in non-english countries can be English, but they don't use AM/PM notation (what seems to be used mainly in US and UK). |
Closed via home-assistant/frontend#170! |
I would like to reopen this issue. home-assistant/frontend#170 Indeed solves part of the problem stated in the start topic. It fixes the date format in the logbook, but not in the state history chart timeline. The problem as shown in the screenshots is still present. I opened an issue at the home-assistant-polymer project as wel: home-assistant/frontend#196 |
I can confirm I'm still seeing this issue in the timeline pop-over (both in the States UI and the History UI). It seems to have been addressed everywhere else. Seen in Firefox 51.0.1 set to Dutch (nl) on macOS 10.12.4 bèta. |
Agree this should be reopened. home-assistant/frontend#170 is a step in the right direction, but the Google charts time formatting still hasn't been addressed. |
There is a new issue in the home-assistant-polymer repo: home-assistant/frontend#196 |
The format of time is inconsistent in the interface. We use 24 hour style here. I assume this should be configured trough the Timezone parameter in the configuration. This is set to Europe/Brussels.
The sun card:
The timeline at the top is displaying correct 24-hour style. The information at the bottom is showing 12-hour style.
Logbook:
The time in the logbook is in 12-hour style.
Timeline popover:
The timeline itself is displayed fine, but the popup is in 12-hour style again.
The text was updated successfully, but these errors were encountered: