Fixed midnight reset

This commit is contained in:
2021-11-13 00:06:33 +03:00
parent 9f07a0897f
commit 9c881bd430
3 changed files with 14 additions and 10 deletions

View File

@@ -121,7 +121,7 @@ export default {
.categories {
display: flex;
margin: 0 32px;
margin: 0 64px 0 32px;
overflow-x: scroll;
.category {
@@ -157,8 +157,8 @@ export default {
.settings {
position: fixed;
bottom: 8px;
right: 8px;
bottom: 16px;
right: 16px;
}
}
}

View File

@@ -28,7 +28,8 @@ export default {
beforeMount() {
const lastMidnight = new Date();
lastMidnight.setHours(0, 0, 0, 0);
if (this.midnightReset && this.lastReset < lastMidnight) {
const lastReset = new Date(this.lastReset);
if (this.midnightReset && lastReset < lastMidnight) {
this.resetTasks();
}
},

View File

@@ -1,11 +1,14 @@
<template>
<div class="task-list">
<input
class="add-task"
v-model=newTask
placeholder="Add new task"
@keypress.enter="addTask"
/>
<div>
<input
class="add-task"
v-model=newTask
placeholder="Add new task"
@keypress.enter="addTask"
/>
</div>
<Task
v-for="task in filteredTasks"
:key="task.startedAt"