mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 17:56:46 +00:00
Fix condition time (#11866)
Co-authored-by: Paulus Schoutsen <balloob@gmail.com> Co-authored-by: Zack Barett <zackbarett@hey.com>
This commit is contained in:
parent
298296a81f
commit
7abf9c2473
@ -117,8 +117,8 @@ export class HaTimeCondition extends LitElement implements ConditionElement {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
mode_before: "value",
|
mode_before: inputModeBefore ? "input" : "value",
|
||||||
mode_after: "value",
|
mode_after: inputModeAfter ? "input" : "value",
|
||||||
...this.condition,
|
...this.condition,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -137,18 +137,11 @@ export class HaTimeCondition extends LitElement implements ConditionElement {
|
|||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
const newValue = ev.detail.value;
|
const newValue = ev.detail.value;
|
||||||
|
|
||||||
const newModeAfter = newValue.mode_after === "input";
|
this._inputModeAfter = newValue.mode_after === "input";
|
||||||
const newModeBefore = newValue.mode_before === "input";
|
this._inputModeBefore = newValue.mode_before === "input";
|
||||||
|
|
||||||
if (newModeAfter !== this._inputModeAfter) {
|
delete newValue.mode_after;
|
||||||
this._inputModeAfter = newModeAfter;
|
delete newValue.mode_before;
|
||||||
newValue.after = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newModeBefore !== this._inputModeBefore) {
|
|
||||||
this._inputModeBefore = newModeBefore;
|
|
||||||
newValue.before = undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.keys(newValue).forEach((key) =>
|
Object.keys(newValue).forEach((key) =>
|
||||||
newValue[key] === undefined || newValue[key] === ""
|
newValue[key] === undefined || newValue[key] === ""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user