From edce1901d7ab335ccc718aceda5fd939b31fb635 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Benecke Date: Fri, 24 Jan 2025 18:13:01 +0100 Subject: [PATCH] Display year when automation was last triggered in automation list (#23864) * Display year when automation was last triggered in automation list * Use function --- src/panels/config/automation/ha-automation-picker.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/panels/config/automation/ha-automation-picker.ts b/src/panels/config/automation/ha-automation-picker.ts index 98777230c4fc..06fd009c2d2a 100644 --- a/src/panels/config/automation/ha-automation-picker.ts +++ b/src/panels/config/automation/ha-automation-picker.ts @@ -28,7 +28,7 @@ import { styleMap } from "lit/directives/style-map"; import memoizeOne from "memoize-one"; import { computeCssColor } from "../../../common/color/compute-color"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; -import { formatShortDateTime } from "../../../common/datetime/format_date_time"; +import { formatShortDateTimeWithConditionalYear } from "../../../common/datetime/format_date_time"; import { relativeTime } from "../../../common/datetime/relative_time"; import { storage } from "../../../common/decorators/storage"; import type { HASSDomEvent } from "../../../common/dom/fire_event"; @@ -324,7 +324,11 @@ class HaAutomationPicker extends SubscribeMixin(LitElement) { const dayDifference = differenceInDays(now, date); return html` ${dayDifference > 3 - ? formatShortDateTime(date, locale, this.hass.config) + ? formatShortDateTimeWithConditionalYear( + date, + this.hass.locale, + this.hass.config + ) : relativeTime(date, locale)} `; },