Skip to content

Commit

Permalink
do check in 1 place
Browse files Browse the repository at this point in the history
  • Loading branch information
bramkragten committed Jan 3, 2024
1 parent 76b277b commit ea11afc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
5 changes: 1 addition & 4 deletions src/data/todo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,7 @@ export const updateItem = (
item: item.uid,
rename: item.summary,
status: item.status,
description:
item.description === undefined || item.description
? item.description
: null,
description: item.description,
due_datetime: item.due?.includes("T") ? item.due : undefined,
due_date:
item.due === undefined || item.due?.includes("T")
Expand Down
12 changes: 7 additions & 5 deletions src/panels/todo/dialog-todo-item-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,11 +319,13 @@ class DialogTodoItemEditor extends LitElement {
await updateItem(this.hass!, this._params!.entity, {
...entry,
summary: this._summary,
description: this._todoListSupportsFeature(
TodoListEntityFeature.SET_DESCRIPTION_ON_ITEM
)
? this._description
: undefined,
description:
this._description ||
(this._todoListSupportsFeature(
TodoListEntityFeature.SET_DESCRIPTION_ON_ITEM
)
? null
: undefined),
due: this._due
? this._hasTime
? this._due.toISOString()
Expand Down

0 comments on commit ea11afc

Please sign in to comment.