From 7464bcac0d4c027a1452cca92a6bb43e7805f762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Raimund=20Schl=C3=BC=C3=9Fler?= Date: Mon, 5 Aug 2024 22:08:33 +0200 Subject: [PATCH] fix: correctly handle timezone of completed, created and modified d ate 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 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/models/task.js b/src/models/task.js index b4be0f8f5..bc5a20da9 100644 --- a/src/models/task.js +++ b/src/models/task.js @@ -311,13 +311,14 @@ export default class Task { const now = ICAL.Time.fromJSDate(new Date(), true) this.vtodo.updatePropertyWithValue('completed', now) this._completedDate = now + this._completedDateMoment = moment(now, 'YYYYMMDDTHHmmssZ') } else { this.vtodo.removeProperty('completed') this._completedDate = null + this._completedDateMoment = moment(null) } - this.updateLastModified() this._completed = completed - this._completedDateMoment = moment(this._completedDate, 'YYYYMMDDTHHmmssZ') + this.updateLastModified() } get completedDate() { @@ -630,7 +631,7 @@ export default class Task { this.vtodo.updatePropertyWithValue('last-modified', now) this.vtodo.updatePropertyWithValue('dtstamp', now) this._modified = now - this._modifiedMoment = moment(this._modified, 'YYYYMMDDTHHmmssZ') + this._modifiedMoment = moment(now, 'YYYYMMDDTHHmmssZ') } get modified() { @@ -651,13 +652,13 @@ export default class Task { set created(createdDate) { this.vtodo.updatePropertyWithValue('created', createdDate) - this.updateLastModified() - this._created = this.vtodo.getFirstPropertyValue('created') - this._createdMoment = moment(this._created, 'YYYYMMDDTHHmmssZ') + this._created = createdDate + this._createdMoment = moment(createdDate, 'YYYYMMDDTHHmmssZ') // Update the sortorder if necessary if (this.vtodo.getFirstPropertyValue('x-apple-sort-order') === null) { this._sortOrder = this.getSortOrder() } + this.updateLastModified() } get class() {