Skip to content
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

use locale.time_format for displaying time #163

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cucko
Copy link

@cucko cucko commented Nov 18, 2023

updated toLocaleTimeString to use hass.locale.time_format with fallback to hass.language.
it's very useful for users that have English language selected but want to see 24h time display.

@@ -150,10 +151,10 @@ class WeatherCard extends LitElement {
return html`
<ha-card @click="${this._handleClick}">
${this._config.current !== false ? this.renderCurrent(stateObj) : ""}
${this._config.details !== false ? this.renderDetails(stateObj, lang) : ""}
${this._config.details !== false ? this.renderDetails(stateObj, lang, time_format) : ""}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should pass hass.locale here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That can also work, but in HA there is a time format setting that can override system locale . If it's set, i think it should use time_formwt, then fallback to locale, and then to hass.lang.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be nice if this can be merged. I use an english OS, dutch locale. Logbook and history shows 24hr timeformat, unfortunately this card does not and gives me AM/PM times. It gives me headaches 🤣

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants