From bc0e2bf4741caeab522e9f366cc77810ab54cf3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raimund=20Schl=C3=BC=C3=9Fler?= Date: Mon, 5 Aug 2024 19:52:32 +0200 Subject: [PATCH] fix: do not use buggy toJSDate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Raimund Schlüßler --- src/models/task.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/models/task.js b/src/models/task.js index 8ec2bacde..b4be0f8f5 100644 --- a/src/models/task.js +++ b/src/models/task.js @@ -91,10 +91,9 @@ export default class Task { this._summary = this.vtodo.getFirstPropertyValue('summary') || '' this._priority = this.vtodo.getFirstPropertyValue('priority') || 0 this._complete = this.vtodo.getFirstPropertyValue('percent-complete') || 0 - const comp = this.vtodo.getFirstPropertyValue('completed') - this._completed = !!comp - this._completedDate = comp ? comp.toJSDate() : null + this._completedDate = this.vtodo.getFirstPropertyValue('completed') this._completedDateMoment = moment(this._completedDate, 'YYYYMMDDTHHmmssZ') + this._completed = !!this._completedDate this._status = this.vtodo.getFirstPropertyValue('status') this._note = this.vtodo.getFirstPropertyValue('description') || '' this._related = this.getParent()?.getFirstValue() || null @@ -308,15 +307,16 @@ export default class Task { } setCompleted(completed) { - const now = ICAL.Time.fromJSDate(new Date(), true) if (completed) { + const now = ICAL.Time.fromJSDate(new Date(), true) this.vtodo.updatePropertyWithValue('completed', now) + this._completedDate = now } else { this.vtodo.removeProperty('completed') + this._completedDate = null } this.updateLastModified() this._completed = completed - this._completedDate = completed ? now.toJSDate() : null this._completedDateMoment = moment(this._completedDate, 'YYYYMMDDTHHmmssZ') }