Fix default time_format option. Fixes #24798 (#24819)

* Fix default time_format option. Fixes #24798

* Update en.json

* Update src/translations/en.json

---------

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
Darren Griffin 2025-03-28 14:13:50 +00:00 committed by Bram Kragten
parent 724adab2d6
commit e8e65a4293
2 changed files with 7 additions and 2 deletions

View File

@ -72,7 +72,7 @@ export class HuiClockCardEditor
selector: {
select: {
mode: "dropdown",
options: Object.values(TimeFormat).map((value) => ({
options: ["auto", ...Object.values(TimeFormat)].map((value) => ({
value,
label: localize(
`ui.panel.lovelace.editor.card.clock.time_formats.${value}`
@ -86,7 +86,7 @@ export class HuiClockCardEditor
private _data = memoizeOne((config) => ({
clock_size: "small",
time_format: TimeFormat.language,
time_format: "auto",
show_seconds: false,
...config,
}));
@ -113,6 +113,10 @@ export class HuiClockCardEditor
}
private _valueChanged(ev: CustomEvent): void {
if (ev.detail.value.time_format === "auto") {
delete ev.detail.value.time_format;
}
fireEvent(this, "config-changed", { config: ev.detail.value });
}

View File

@ -7163,6 +7163,7 @@
"show_seconds": "Display seconds",
"time_format": "Time format",
"time_formats": {
"auto": "Use user settings",
"language": "[%key:ui::panel::profile::time_format::formats::language%]",
"system": "[%key:ui::panel::profile::time_format::formats::system%]",
"24": "[%key:ui::panel::profile::time_format::formats::24%]",