feat: move logic of ShowTasksInRange component to ShowTasks

This commit is contained in:
kolaente 2022-02-05 21:12:35 +01:00
parent c41397f5db
commit 43e83350bd
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
3 changed files with 15 additions and 24 deletions

View file

@ -47,6 +47,10 @@ import {LOADING, LOADING_MODULE} from '@/store/mutation-types'
import LlamaCool from '@/assets/llama-cool.svg?component'
import DatepickerWithRange from '@/components/date/datepickerWithRange'
function getNextWeekDate() {
return new Date((new Date()).getTime() + 7 * 24 * 60 * 60 * 1000)
}
export default {
name: 'ShowTasks',
components: {
@ -62,8 +66,6 @@ export default {
}
},
props: {
startDate: Date,
endDate: Date,
showAll: Boolean,
},
created() {
@ -84,14 +86,14 @@ export default {
return !isNaN(d)
? d
: this.startDate
: new Date()
},
dateTo() {
const d = new Date(Number(this.$route.query.to))
return !isNaN(d)
? d
: this.endDate
: getNextWeekDate()
},
showNulls() {
return this.$route.query.showNulls === 'true'

View file

@ -1,20 +0,0 @@
<template>
<div class="content has-text-centered">
<ShowTasks
:end-date="endDate"
:start-date="startDate"
/>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import ShowTasks from './ShowTasks.vue'
function getNextWeekDate() {
return new Date((new Date()).getTime() + 7 * 24 * 60 * 60 * 1000)
}
const startDate = ref(new Date())
const endDate = ref(getNextWeekDate())
</script>

View file

@ -0,0 +1,9 @@
<template>
<div class="content has-text-centered">
<ShowTasks/>
</div>
</template>
<script lang="ts" setup>
import ShowTasks from './ShowTasks.vue'
</script>