mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-20 15:56:35 +00:00
Correctly handle seconds in top "delay" key (#8415)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
parent
d51fd1e2f9
commit
77911980cb
@ -22,13 +22,17 @@ export class HaDelayAction extends LitElement implements ActionElement {
|
|||||||
let data: HaFormTimeData = {};
|
let data: HaFormTimeData = {};
|
||||||
|
|
||||||
if (typeof this.action.delay !== "object") {
|
if (typeof this.action.delay !== "object") {
|
||||||
|
if (isNaN(this.action.delay)) {
|
||||||
const parts = this.action.delay?.toString().split(":") || [];
|
const parts = this.action.delay?.toString().split(":") || [];
|
||||||
data = {
|
data = {
|
||||||
hours: Number(parts[0]),
|
hours: Number(parts[0]) || 0,
|
||||||
minutes: Number(parts[1]),
|
minutes: Number(parts[1]) || 0,
|
||||||
seconds: Number(parts[2]),
|
seconds: Number(parts[2]) || 0,
|
||||||
milliseconds: Number(parts[3]),
|
milliseconds: Number(parts[3]) || 0,
|
||||||
};
|
};
|
||||||
|
} else {
|
||||||
|
data = { seconds: this.action.delay };
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
const { days, minutes, seconds, milliseconds } = this.action.delay;
|
const { days, minutes, seconds, milliseconds } = this.action.delay;
|
||||||
let { hours } = this.action.delay || 0;
|
let { hours } = this.action.delay || 0;
|
||||||
@ -46,7 +50,8 @@ export class HaDelayAction extends LitElement implements ActionElement {
|
|||||||
.data=${data}
|
.data=${data}
|
||||||
enableMillisecond
|
enableMillisecond
|
||||||
@value-changed=${this._valueChanged}
|
@value-changed=${this._valueChanged}
|
||||||
></ha-time-input>
|
>
|
||||||
|
</ha-time-input>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user