Skip to content

use locale.time_format for displaying time#163

Open
cucko wants to merge 1 commit into
bramkragten:masterfrom
cucko:master
Open

use locale.time_format for displaying time#163
cucko wants to merge 1 commit into
bramkragten:masterfrom
cucko:master

Conversation

@cucko

@cucko cucko commented Nov 18, 2023

Copy link
Copy Markdown

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.

Comment thread dist/weather-card.js
<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
Copy Markdown
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
Copy Markdown
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
Copy Markdown

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