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

View File

@@ -28,7 +28,8 @@ export default {
beforeMount() { beforeMount() {
const lastMidnight = new Date(); const lastMidnight = new Date();
lastMidnight.setHours(0, 0, 0, 0); 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(); this.resetTasks();
} }
}, },

View File

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