From 59f4e7f598a9d98a723e3a0d8ed833af2106b38f Mon Sep 17 00:00:00 2001 From: Carlton Date: Sun, 26 Jul 2020 20:36:55 +0200 Subject: [PATCH] fix (task list) replace deprecated cache-busting of computed properties with methods --- website/client/src/components/tasks/task.vue | 38 ++++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/website/client/src/components/tasks/task.vue b/website/client/src/components/tasks/task.vue index 094c4f752f..8e15d60f93 100644 --- a/website/client/src/components/tasks/task.vue +++ b/website/client/src/components/tasks/task.vue @@ -223,14 +223,14 @@
- {{ dueIn }} + {{ formatDueDate() }}
0; }, @@ -1001,6 +983,22 @@ export default { item.completed = !item.completed; // @TODO this should go into the action? this.scoreChecklistItem({ taskId: this.task._id, itemId: item.id }); }, + calculateTimeTillDue () { + const endOfToday = moment().endOf('day'); + const endOfDueDate = moment(this.task.date).endOf('day'); + + return moment.duration(endOfDueDate.diff(endOfToday)); + }, + checkIfOverdue () { + return this.calculateTimeTillDue().asDays() <= 0; + }, + formatDueDate () { + const dueIn = this.calculateTimeTillDue().asDays() === 0 + ? this.$t('today') + : this.calculateTimeTillDue().humanize(true); + + return this.task.date && this.$t('dueIn', { dueIn }); + }, edit (e, task) { if (this.isRunningYesterdailies || !this.showEdit) return;