Fix due date when no time in certain timezones (#19280)

* Fix due date when no time in certain timezones

* Update dialog-todo-item-editor.ts
This commit is contained in:
Bram Kragten 2024-01-04 14:24:33 +01:00
parent a1cf18468b
commit a31b9f1b4d
2 changed files with 4 additions and 2 deletions

View File

@ -335,7 +335,7 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard {
const due = item.due
? item.due.includes("T")
? new Date(item.due)
: endOfDay(new Date(item.due))
: endOfDay(new Date(`${item.due}T00:00:00`))
: undefined;
const today =
due && !item.due!.includes("T") && isSameDay(new Date(), due);

View File

@ -60,8 +60,10 @@ class DialogTodoItemEditor extends LitElement {
this._checked = entry.status === TodoItemStatus.Completed;
this._summary = entry.summary;
this._description = entry.description || "";
this._due = entry.due ? new Date(entry.due) : undefined;
this._hasTime = entry.due?.includes("T") || false;
this._due = entry.due
? new Date(this._hasTime ? entry.due : `${entry.due}T00:00:00`)
: undefined;
} else {
this._hasTime = false;
this._checked = false;