From 6258c59c18df24ea6a0824c2d6e34c7bbe851c88 Mon Sep 17 00:00:00 2001 From: kolaente Date: Sun, 9 Feb 2020 17:33:04 +0100 Subject: [PATCH] Fix initial dates on task edit sidebar --- src/components/tasks/edit-task.vue | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/tasks/edit-task.vue b/src/components/tasks/edit-task.vue index 4eb1d1a8c..b5d710677 100644 --- a/src/components/tasks/edit-task.vue +++ b/src/components/tasks/edit-task.vue @@ -199,6 +199,7 @@ watch: { task() { this.taskEditTask = this.task + this.initTaskFields() } }, created() { @@ -206,13 +207,20 @@ this.taskService = new TaskService() this.newTask = new TaskModel() this.taskEditTask = this.task + this.initTaskFields() }, methods: { + initTaskFields() { + this.taskEditTask.dueDate = +new Date(this.task.dueDate) === 0 ? null : this.task.dueDate + this.taskEditTask.startDate = +new Date(this.task.startDate) === 0 ? null : this.task.startDate + this.taskEditTask.endDate = +new Date(this.task.endDate) === 0 ? null : this.task.endDate + }, editTaskSubmit() { this.taskService.update(this.taskEditTask) .then(r => { this.$set(this, 'taskEditTask', r) this.success({message: 'The task was successfully updated.'}, this) + this.initTaskFields() }) .catch(e => { this.error(e, this)