From ab65ce819fdbeac55ca2fdd38ab69456c99b66c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20S=C3=B8rensen?= Date: Mon, 30 May 2022 16:57:28 +0200 Subject: [PATCH] Fallback to 0 for undefined offsets (#12823) --- .../trigger/types/ha-automation-trigger-calendar.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/panels/config/automation/trigger/types/ha-automation-trigger-calendar.ts b/src/panels/config/automation/trigger/types/ha-automation-trigger-calendar.ts index 51717108c2..7d205322cd 100644 --- a/src/panels/config/automation/trigger/types/ha-automation-trigger-calendar.ts +++ b/src/panels/config/automation/trigger/types/ha-automation-trigger-calendar.ts @@ -106,7 +106,9 @@ export class HaCalendarTrigger extends LitElement implements TriggerElement { const offsetType = ev.detail.value.offset_type === "before" ? "-" : ""; const newTrigger = { ...ev.detail.value, - offset: `${offsetType}${duration.hours}:${duration.minutes}:${duration.seconds}`, + offset: `${offsetType}${duration.hours ?? 0}:${duration.minutes ?? 0}:${ + duration.seconds ?? 0 + }`, }; delete newTrigger.offset_type; fireEvent(this, "value-changed", { value: newTrigger });