Skip to content

Commit bcdadb7

Browse files
committed
change undefined behavior
1 parent 616627c commit bcdadb7

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

src/components/ha-selector/ha-selector-datetime.ts

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { css, html, LitElement, PropertyValues } from "lit";
1+
import { css, html, LitElement } from "lit";
22
import { customElement, property, query } from "lit/decorators";
33
import { fireEvent } from "../../common/dom/fire_event";
44
import type { DateTimeSelector } from "../../data/selector";
@@ -58,22 +58,13 @@ export class HaDateTimeSelector extends LitElement {
5858
`;
5959
}
6060

61-
protected updated(changedProps: PropertyValues): void {
62-
super.updated(changedProps);
63-
if (changedProps.has("disabled") && !this.disabled && !this.value) {
64-
this._sendChangedEvent();
65-
}
66-
}
67-
6861
private _valueChanged(ev: CustomEvent): void {
6962
ev.stopPropagation();
70-
this._sendChangedEvent();
71-
}
72-
73-
private _sendChangedEvent(): void {
74-
fireEvent(this, "value-changed", {
75-
value: `${this._dateInput.value ?? ""} ${this._timeInput.value}`,
76-
});
63+
if (this._dateInput.value && this._timeInput.value) {
64+
fireEvent(this, "value-changed", {
65+
value: `${this._dateInput.value} ${this._timeInput.value}`,
66+
});
67+
}
7768
}
7869

7970
static styles = css`

0 commit comments

Comments
 (0)