mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-16 22:06:34 +00:00
Fix checking todo item that dont support due date (#19262)
* Fix checking todo item that dont support due date * make cleaner * Revert "make cleaner" This reverts commit fa33b3361451dd334d9f69142f9754a1ea2c1ca4. * Update dialog-todo-item-editor.ts * do check in 1 place
This commit is contained in:
parent
acbb7e0453
commit
8368fb4408
@ -83,9 +83,12 @@ export const updateItem = (
|
|||||||
item: item.uid,
|
item: item.uid,
|
||||||
rename: item.summary,
|
rename: item.summary,
|
||||||
status: item.status,
|
status: item.status,
|
||||||
description: item.description || null,
|
description: item.description,
|
||||||
due_datetime: item.due?.includes("T") ? item.due : undefined,
|
due_datetime: item.due?.includes("T") ? item.due : undefined,
|
||||||
due_date: item.due?.includes("T") ? undefined : item.due || null,
|
due_date:
|
||||||
|
item.due === undefined || item.due?.includes("T")
|
||||||
|
? undefined
|
||||||
|
: item.due,
|
||||||
},
|
},
|
||||||
{ entity_id }
|
{ entity_id }
|
||||||
);
|
);
|
||||||
@ -102,7 +105,10 @@ export const createItem = (
|
|||||||
item: item.summary,
|
item: item.summary,
|
||||||
description: item.description || undefined,
|
description: item.description || undefined,
|
||||||
due_datetime: item.due?.includes("T") ? item.due : undefined,
|
due_datetime: item.due?.includes("T") ? item.due : undefined,
|
||||||
due_date: item.due?.includes("T") ? undefined : item.due,
|
due_date:
|
||||||
|
item.due === undefined || item.due?.includes("T")
|
||||||
|
? undefined
|
||||||
|
: item.due,
|
||||||
},
|
},
|
||||||
{ entity_id }
|
{ entity_id }
|
||||||
);
|
);
|
||||||
|
@ -476,7 +476,8 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await updateItem(this.hass!, this._entityId!, {
|
await updateItem(this.hass!, this._entityId!, {
|
||||||
...item,
|
uid: item.uid,
|
||||||
|
summary: item.summary,
|
||||||
status:
|
status:
|
||||||
item.status === TodoItemStatus.NeedsAction
|
item.status === TodoItemStatus.NeedsAction
|
||||||
? TodoItemStatus.Completed
|
? TodoItemStatus.Completed
|
||||||
|
@ -324,14 +324,20 @@ class DialogTodoItemEditor extends LitElement {
|
|||||||
(this._todoListSupportsFeature(
|
(this._todoListSupportsFeature(
|
||||||
TodoListEntityFeature.SET_DESCRIPTION_ON_ITEM
|
TodoListEntityFeature.SET_DESCRIPTION_ON_ITEM
|
||||||
)
|
)
|
||||||
? // backend should accept null to clear the field, but it doesn't now
|
? null
|
||||||
null
|
|
||||||
: undefined),
|
: undefined),
|
||||||
due: this._due
|
due: this._due
|
||||||
? this._hasTime
|
? this._hasTime
|
||||||
? this._due.toISOString()
|
? this._due.toISOString()
|
||||||
: this._formatDate(this._due)
|
: this._formatDate(this._due)
|
||||||
: null,
|
: this._todoListSupportsFeature(
|
||||||
|
TodoListEntityFeature.SET_DUE_DATETIME_ON_ITEM
|
||||||
|
) ||
|
||||||
|
this._todoListSupportsFeature(
|
||||||
|
TodoListEntityFeature.SET_DUE_DATE_ON_ITEM
|
||||||
|
)
|
||||||
|
? null
|
||||||
|
: undefined,
|
||||||
status: this._checked
|
status: this._checked
|
||||||
? TodoItemStatus.Completed
|
? TodoItemStatus.Completed
|
||||||
: TodoItemStatus.NeedsAction,
|
: TodoItemStatus.NeedsAction,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user