mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 19:26:36 +00:00
Calendar trigger: Handle optional offset better (#23474)
Calendar empty offset
This commit is contained in:
parent
1b9cbe434d
commit
cf91e6a2a3
@ -737,18 +737,22 @@ const tryDescribeTrigger = (
|
|||||||
? computeStateName(hass.states[trigger.entity_id])
|
? computeStateName(hass.states[trigger.entity_id])
|
||||||
: trigger.entity_id;
|
: trigger.entity_id;
|
||||||
|
|
||||||
let offsetChoice = trigger.offset.startsWith("-") ? "before" : "after";
|
let offsetChoice: string = "other";
|
||||||
let offset: string | string[] = trigger.offset.startsWith("-")
|
let offset: string | string[] = "";
|
||||||
? trigger.offset.substring(1).split(":")
|
if (trigger.offset) {
|
||||||
: trigger.offset.split(":");
|
offsetChoice = trigger.offset.startsWith("-") ? "before" : "after";
|
||||||
const duration = {
|
offset = trigger.offset.startsWith("-")
|
||||||
hours: offset.length > 0 ? +offset[0] : 0,
|
? trigger.offset.substring(1).split(":")
|
||||||
minutes: offset.length > 1 ? +offset[1] : 0,
|
: trigger.offset.split(":");
|
||||||
seconds: offset.length > 2 ? +offset[2] : 0,
|
const duration = {
|
||||||
};
|
hours: offset.length > 0 ? +offset[0] : 0,
|
||||||
offset = formatDurationLong(hass.locale, duration);
|
minutes: offset.length > 1 ? +offset[1] : 0,
|
||||||
if (offset === "") {
|
seconds: offset.length > 2 ? +offset[2] : 0,
|
||||||
offsetChoice = "other";
|
};
|
||||||
|
offset = formatDurationLong(hass.locale, duration);
|
||||||
|
if (offset === "") {
|
||||||
|
offsetChoice = "other";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return hass.localize(
|
return hass.localize(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user