Fix initial dates on task edit sidebar

This commit is contained in:
kolaente 2020-02-09 17:33:04 +01:00
parent 301c23fa9a
commit 6258c59c18
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -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)