Comments (20)
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.
from core.
Hmm, strange, my browser is set up for the Dutch language:
I also have the same behavior on my Android device. Are your sure it's not the 12h system that's hardcoded?
from core.
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');
};
See http://momentjs.com/docs/#/i18n/changing-locale/
from core.
Ah dang, it seems like you're right.
If only Apple would implement toLocaleDateString and toLocaleTimeString, it would make our lives so much easier.
from core.
Still present as of 0.20.x
from core.
Is this still a thing?
from core.
Yep, still the same.
from core.
I think moment.js could handle this. But I don't think we want add a new dependency.
from core.
AFAIK, moment is already a dependency. Check my comment above. It just isn't initialised correctly.
from core.
We removed moment, it is way too big for what it does. We use JavaScript
native toLocaleString and toLocaleDateString.
On Wed, Oct 26, 2016 at 10:38 PM, Michaël Arnauts [email protected]
wrote:
AFAIK, moment is already a dependency. Check my comment above. It just
isn't initialised correctly.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
#184 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABYJ2tCH_Hmk_4mNHcQvhTWExJCiYpXrks5q4DjOgaJpZM4FFpdB
.
PaulusSchoutsen.nl
It's nice to be important but it's more important to be nice.
from core.
Okay, I didn't know that.
from core.
The times in the graphs are configured in a different way however.
from core.
Is there any Polyfill?
from core.
There seems to be a different implementation between browsers.
- Firefox takes the topmost language in the browser configuration (
nl
), and considers that to be the preferred language. - Chrome takes the language of the installed Chrome version (
en
), and considers that to be the preferred language, even thoughnl
is at the top of my language configuration list. - I'm not sure what Edge and Internet Explorer 11 do.
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 navigator.language
.
language = navigator.languages ? navigator.languages[0] : navigator.language || navigator.userLanguage;
This picks the first selected language in your settings, and fallbacks to navigator.language
or navigator.userLanguage
(for old IE versions).
What do you think?
from core.
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).
from core.
Closed via home-assistant/frontend#170!
from core.
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
from core.
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.
Same behaviour in Chrome 55.0.2883.95 set to Dutch (nl), as well as in Safari 10.1 (12603.1.20.1) which seems to use the OS language setting (Belgian Dutch).
from core.
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.
from core.
There is a new issue in the home-assistant-polymer repo: home-assistant/frontend#196
The backend is reporting the time like 2017-02-13T18:38:47.427063+00:00
, so the issue lies in the frontend.
from core.
Related Issues (20)
- User is able to add same UniFi Protect NVR twice HOT 6
- start_charging stop_charging service no longer working HOT 2
- SwitchBot Bot (Switch) upgraded for Advanced feature (>4.9) stop responding in HA randomly HOT 1
- Hidden devices excluded from label targeting
- Hydrawise Integration cannot be installed HOT 1
- TP-Link Smart Home DataUpdateCoordinator.__init__() takes 3 positional arguments but 4 were given HOT 1
- HUE ZeroDivisionError HOT 1
- Another wifi Tuya presence sensor is missing the lux sensor entity, take 2
- Water Heater Leak Shutoff Valve Sensor Showing Closed instead of Open HOT 4
- Glances - not seeing GPU information HOT 7
- Error from stream worker: Error demuxing stream: [Errno 110] Operation timed out
- homeassistant.helpers.event - Error while processing template
- iZone logs warning on startup about 'Entity does not set X but implements Y method' HOT 1
- Logger: plexapi
- Timeout sending notification to https://mobile-apps.home-assistant.io/api/sendPush/android/v1
- measurement 'None' which is not a valid unit for the device class ('temperature') it is using; expected one of ['°C', '°F', 'K'];
- received an invalid new state from sensor.beergarden_garden_tap_water_consumed : unknown HOT 6
- ValueError: Config entry has already been setup! HOT 6
- Issue adding Shelly PM Mini Gen 3 HOT 3
- Somfy Elixo 500 3S IO Pedestrian mode not available HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.