Skip to content

Commit

Permalink
Display year when automation was last triggered in automation list (#…
Browse files Browse the repository at this point in the history
…23864)

* Display year when automation was last triggered in automation list

* Use function
  • Loading branch information
jpbede authored Jan 24, 2025
1 parent 5460870 commit edce190
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/panels/config/automation/ha-automation-picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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)}
`;
},
Expand Down

0 comments on commit edce190

Please sign in to comment.