chore: remove date mixins
This commit is contained in:
parent
332acf012c
commit
b0ee316a26
14 changed files with 43 additions and 24 deletions
|
@ -110,10 +110,10 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {format} from 'date-fns'
|
import { formatDate } from '@/helpers/time/formatDate'
|
||||||
import BaseButton from '@/components/base/BaseButton.vue'
|
import BaseButton from '@/components/base/BaseButton.vue'
|
||||||
|
|
||||||
const exampleDate = format(new Date(), 'yyyy-MM-dd')
|
const exampleDate = formatDate(new Date(), 'yyyy-MM-dd')
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
@ -97,7 +97,7 @@ import {i18n} from '@/i18n'
|
||||||
|
|
||||||
import BaseButton from '@/components/base/BaseButton.vue'
|
import BaseButton from '@/components/base/BaseButton.vue'
|
||||||
|
|
||||||
import {format} from 'date-fns'
|
import {formatDate, formatDateShort} from '@/helpers/time/formatDate'
|
||||||
import {calculateDayInterval} from '@/helpers/time/calculateDayInterval'
|
import {calculateDayInterval} from '@/helpers/time/calculateDayInterval'
|
||||||
import {calculateNearestHours} from '@/helpers/time/calculateNearestHours'
|
import {calculateNearestHours} from '@/helpers/time/calculateNearestHours'
|
||||||
import {closeWhenClickedOutside} from '@/helpers/closeWhenClickedOutside'
|
import {closeWhenClickedOutside} from '@/helpers/closeWhenClickedOutside'
|
||||||
|
@ -170,11 +170,12 @@ export default defineComponent({
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|
||||||
return format(this.date, 'yyy-LL-dd H:mm')
|
return formatDate(this.date, 'yyy-LL-dd H:mm')
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
formatDateShort,
|
||||||
setDateValue(newVal) {
|
setDateValue(newVal) {
|
||||||
if (newVal === null) {
|
if (newVal === null) {
|
||||||
this.date = null
|
this.date = null
|
||||||
|
@ -233,7 +234,7 @@ export default defineComponent({
|
||||||
const interval = calculateDayInterval(date)
|
const interval = calculateDayInterval(date)
|
||||||
const newDate = new Date()
|
const newDate = new Date()
|
||||||
newDate.setDate(newDate.getDate() + interval)
|
newDate.setDate(newDate.getDate() + interval)
|
||||||
return format(newDate, 'E')
|
return formatDate(newDate, 'E')
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
{{ n.toText(userInfo) }}
|
{{ n.toText(userInfo) }}
|
||||||
</BaseButton>
|
</BaseButton>
|
||||||
</div>
|
</div>
|
||||||
<span class="created" v-tooltip="formatDate(n.created)">
|
<span class="created" v-tooltip="formatDateLong(n.created)">
|
||||||
{{ formatDateSince(n.created) }}
|
{{ formatDateSince(n.created) }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -56,6 +56,7 @@ import NotificationModel, { NOTIFICATION_NAMES as names} from '@/models/notifica
|
||||||
import {closeWhenClickedOutside} from '@/helpers/closeWhenClickedOutside'
|
import {closeWhenClickedOutside} from '@/helpers/closeWhenClickedOutside'
|
||||||
import {useStore} from 'vuex'
|
import {useStore} from 'vuex'
|
||||||
import {useRouter} from 'vue-router'
|
import {useRouter} from 'vue-router'
|
||||||
|
import {formatDateLong, formatDateSince} from '@/helpers/time/formatDate'
|
||||||
|
|
||||||
const LOAD_NOTIFICATIONS_INTERVAL = 10000
|
const LOAD_NOTIFICATIONS_INTERVAL = 10000
|
||||||
|
|
||||||
|
|
|
@ -188,6 +188,7 @@ import FilterPopup from '@/components/list/partials/filter-popup.vue'
|
||||||
import BaseButton from '@/components/base/BaseButton.vue'
|
import BaseButton from '@/components/base/BaseButton.vue'
|
||||||
|
|
||||||
import {colorIsDark} from '@/helpers/color/colorIsDark'
|
import {colorIsDark} from '@/helpers/color/colorIsDark'
|
||||||
|
import {formatDate} from '@/helpers/time/formatDate'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'GanttChart',
|
name: 'GanttChart',
|
||||||
|
@ -439,7 +440,7 @@ export default defineComponent({
|
||||||
formatMonthAndYear(year, month) {
|
formatMonthAndYear(year, month) {
|
||||||
month = month < 10 ? '0' + month : month
|
month = month < 10 ? '0' + month : month
|
||||||
const date = new Date(`${year}-${month}-01`)
|
const date = new Date(`${year}-${month}-01`)
|
||||||
return this.format(date, 'MMMM, yyyy')
|
return formatDate(date, 'MMMM, yyyy')
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<p class="attachment-info-meta">
|
<p class="attachment-info-meta">
|
||||||
<i18n-t keypath="task.attachment.createdBy">
|
<i18n-t keypath="task.attachment.createdBy">
|
||||||
<span v-tooltip="formatDate(a.created)">
|
<span v-tooltip="formatDateLong(a.created)">
|
||||||
{{ formatDateSince(a.created) }}
|
{{ formatDateSince(a.created) }}
|
||||||
</span>
|
</span>
|
||||||
<user
|
<user
|
||||||
|
@ -154,6 +154,7 @@ import {mapState} from 'vuex'
|
||||||
|
|
||||||
import { useCopyToClipboard } from '@/composables/useCopyToClipboard'
|
import { useCopyToClipboard } from '@/composables/useCopyToClipboard'
|
||||||
import { uploadFiles, generateAttachmentUrl } from '@/helpers/attachments'
|
import { uploadFiles, generateAttachmentUrl } from '@/helpers/attachments'
|
||||||
|
import {formatDate, formatDateSince, formatDateLong} from '@/helpers/time/formatDate'
|
||||||
|
|
||||||
import BaseButton from '@/components/base/BaseButton'
|
import BaseButton from '@/components/base/BaseButton'
|
||||||
|
|
||||||
|
@ -230,6 +231,10 @@ export default defineComponent({
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
formatDate,
|
||||||
|
formatDateSince,
|
||||||
|
formatDateLong,
|
||||||
|
|
||||||
downloadAttachment(attachment: AttachmentModel) {
|
downloadAttachment(attachment: AttachmentModel) {
|
||||||
this.attachmentService.download(attachment)
|
this.attachmentService.download(attachment)
|
||||||
},
|
},
|
||||||
|
|
|
@ -34,12 +34,12 @@
|
||||||
width="20"
|
width="20"
|
||||||
/>
|
/>
|
||||||
<strong>{{ c.author.getDisplayName() }}</strong>
|
<strong>{{ c.author.getDisplayName() }}</strong>
|
||||||
<span v-tooltip="formatDate(c.created)" class="has-text-grey">
|
<span v-tooltip="formatDateLong(c.created)" class="has-text-grey">
|
||||||
{{ formatDateSince(c.created) }}
|
{{ formatDateSince(c.created) }}
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
v-if="+new Date(c.created) !== +new Date(c.updated)"
|
v-if="+new Date(c.created) !== +new Date(c.updated)"
|
||||||
v-tooltip="formatDate(c.updated)"
|
v-tooltip="formatDateLong(c.updated)"
|
||||||
>
|
>
|
||||||
· {{ $t('task.comment.edited', {date: formatDateSince(c.updated)}) }}
|
· {{ $t('task.comment.edited', {date: formatDateSince(c.updated)}) }}
|
||||||
</span>
|
</span>
|
||||||
|
@ -162,6 +162,7 @@ import TaskCommentService from '@/services/taskComment'
|
||||||
import TaskCommentModel from '@/models/taskComment'
|
import TaskCommentModel from '@/models/taskComment'
|
||||||
import {uploadFile} from '@/helpers/attachments'
|
import {uploadFile} from '@/helpers/attachments'
|
||||||
import {success} from '@/message'
|
import {success} from '@/message'
|
||||||
|
import {formatDateLong, formatDateSince} from '@/helpers/time/formatDate'
|
||||||
|
|
||||||
import type TaskModel from '@/models/task'
|
import type TaskModel from '@/models/task'
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<p class="created">
|
<p class="created">
|
||||||
<time :datetime="formatISO(task.created)" v-tooltip="formatDate(task.created)">
|
<time :datetime="formatISO(task.created)" v-tooltip="formatDateLong(task.created)">
|
||||||
<i18n-t keypath="task.detail.created">
|
<i18n-t keypath="task.detail.created">
|
||||||
<span>{{ formatDateSince(task.created) }}</span>
|
<span>{{ formatDateSince(task.created) }}</span>
|
||||||
{{ task.createdBy.getDisplayName() }}
|
{{ task.createdBy.getDisplayName() }}
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import {computed, toRefs} from 'vue'
|
import {computed, toRefs} from 'vue'
|
||||||
import TaskModel from '@/models/task'
|
import TaskModel from '@/models/task'
|
||||||
import {formatDateLong, formatDateSince} from '@/helpers/time/formatDate'
|
import {formatISO, formatDateLong, formatDateSince} from '@/helpers/time/formatDate'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
task: {
|
task: {
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
<template>
|
<template>
|
||||||
<td v-tooltip="+date === 0 ? '' : formatDate(date)">
|
<td v-tooltip="+date === 0 ? '' : formatDateLong(date)">
|
||||||
<time :datetime="date ? formatISO(date) : null">
|
<time :datetime="date ? formatISO(date) : undefined">
|
||||||
{{ +date === 0 ? '-' : formatDateSince(date) }}
|
{{ +date === 0 ? '-' : formatDateSince(date) }}
|
||||||
</time>
|
</time>
|
||||||
</td>
|
</td>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import {formatISO, formatDateLong, formatDateSince} from '@/helpers/time/formatDate'
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
date: {
|
date: {
|
||||||
type: Date,
|
type: Date,
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
:class="{'overdue': task.dueDate <= new Date() && !task.done}"
|
:class="{'overdue': task.dueDate <= new Date() && !task.done}"
|
||||||
class="due-date"
|
class="due-date"
|
||||||
v-if="task.dueDate > 0"
|
v-if="task.dueDate > 0"
|
||||||
v-tooltip="formatDate(task.dueDate)">
|
v-tooltip="formatDateLong(task.dueDate)">
|
||||||
<span class="icon">
|
<span class="icon">
|
||||||
<icon :icon="['far', 'calendar-alt']"/>
|
<icon :icon="['far', 'calendar-alt']"/>
|
||||||
</span>
|
</span>
|
||||||
|
@ -76,6 +76,7 @@ import Labels from '../../../components/tasks/partials/labels.vue'
|
||||||
import ChecklistSummary from './checklist-summary.vue'
|
import ChecklistSummary from './checklist-summary.vue'
|
||||||
import TaskModel, {TASK_DEFAULT_COLOR} from '@/models/task'
|
import TaskModel, {TASK_DEFAULT_COLOR} from '@/models/task'
|
||||||
|
|
||||||
|
import {formatDateLong, formatISO, formatDateSince} from '@/helpers/time/formatDate'
|
||||||
import {colorIsDark} from '@/helpers/color/colorIsDark'
|
import {colorIsDark} from '@/helpers/color/colorIsDark'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
@ -112,6 +113,9 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
formatDateLong,
|
||||||
|
formatISO,
|
||||||
|
formatDateSince,
|
||||||
colorIsDark,
|
colorIsDark,
|
||||||
async toggleTaskDone(task: TaskModel) {
|
async toggleTaskDone(task: TaskModel) {
|
||||||
this.loadingInternal = true
|
this.loadingInternal = true
|
||||||
|
|
|
@ -43,7 +43,7 @@
|
||||||
v-if="+new Date(task.dueDate) > 0"
|
v-if="+new Date(task.dueDate) > 0"
|
||||||
class="dueDate"
|
class="dueDate"
|
||||||
@click.prevent.stop="showDefer = !showDefer"
|
@click.prevent.stop="showDefer = !showDefer"
|
||||||
v-tooltip="formatDate(task.dueDate)"
|
v-tooltip="formatDateLong(task.dueDate)"
|
||||||
>
|
>
|
||||||
<time
|
<time
|
||||||
:datetime="formatISO(task.dueDate)"
|
:datetime="formatISO(task.dueDate)"
|
||||||
|
@ -107,6 +107,7 @@ import DeferTask from './defer-task.vue'
|
||||||
import {closeWhenClickedOutside} from '@/helpers/closeWhenClickedOutside'
|
import {closeWhenClickedOutside} from '@/helpers/closeWhenClickedOutside'
|
||||||
import {playPop} from '@/helpers/playPop'
|
import {playPop} from '@/helpers/playPop'
|
||||||
import ChecklistSummary from './checklist-summary.vue'
|
import ChecklistSummary from './checklist-summary.vue'
|
||||||
|
import {formatDateSince, formatISO, formatDateLong} from '@/helpers/time/formatDate'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'singleTaskInList',
|
name: 'singleTaskInList',
|
||||||
|
@ -186,6 +187,10 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
formatDateSince,
|
||||||
|
formatISO,
|
||||||
|
formatDateLong,
|
||||||
|
|
||||||
async markAsDone(checked: boolean) {
|
async markAsDone(checked: boolean) {
|
||||||
const updateFunc = async () => {
|
const updateFunc = async () => {
|
||||||
const task = await this.taskService.update(this.task)
|
const task = await this.taskService.update(this.task)
|
||||||
|
|
|
@ -5,8 +5,6 @@ import router from './router'
|
||||||
|
|
||||||
import {error, success} from './message'
|
import {error, success} from './message'
|
||||||
|
|
||||||
import {formatDate, formatDateShort, formatDateLong, formatDateSince, formatISO} from '@/helpers/time/formatDate'
|
|
||||||
|
|
||||||
import {VERSION} from './version.json'
|
import {VERSION} from './version.json'
|
||||||
|
|
||||||
// Notifications
|
// Notifications
|
||||||
|
@ -76,11 +74,6 @@ import {setTitle} from './helpers/setTitle'
|
||||||
|
|
||||||
app.mixin({
|
app.mixin({
|
||||||
methods: {
|
methods: {
|
||||||
formatDateSince,
|
|
||||||
format: formatDate,
|
|
||||||
formatDate: formatDateLong,
|
|
||||||
formatDateShort: formatDateShort,
|
|
||||||
formatISO,
|
|
||||||
getNamespaceTitle,
|
getNamespaceTitle,
|
||||||
getListTitle,
|
getListTitle,
|
||||||
setTitle,
|
setTitle,
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
</template>
|
</template>
|
||||||
<div v-else-if="lastMigrationDate">
|
<div v-else-if="lastMigrationDate">
|
||||||
<p>
|
<p>
|
||||||
{{ $t('migrate.alreadyMigrated1', {name: migrator.name, date: formatDate(lastMigrationDate)}) }}<br/>
|
{{ $t('migrate.alreadyMigrated1', {name: migrator.name, date: formatDateLong(lastMigrationDate)}) }}<br/>
|
||||||
{{ $t('migrate.alreadyMigrated2') }}
|
{{ $t('migrate.alreadyMigrated2') }}
|
||||||
</p>
|
</p>
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
|
@ -73,6 +73,8 @@ import AbstractMigrationFileService from '@/services/migrator/abstractMigrationF
|
||||||
import Logo from '@/assets/logo.svg?component'
|
import Logo from '@/assets/logo.svg?component'
|
||||||
import Message from '@/components/misc/message.vue'
|
import Message from '@/components/misc/message.vue'
|
||||||
|
|
||||||
|
import {formatDateLong} from '@/helpers/time/formatDate'
|
||||||
|
|
||||||
import {MIGRATORS} from './migrators'
|
import {MIGRATORS} from './migrators'
|
||||||
|
|
||||||
const PROGRESS_DOTS_COUNT = 8
|
const PROGRESS_DOTS_COUNT = 8
|
||||||
|
@ -118,6 +120,8 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
formatDateLong,
|
||||||
|
|
||||||
async initMigration() {
|
async initMigration() {
|
||||||
this.migrationService = this.migrator.isFileMigrator
|
this.migrationService = this.migrator.isFileMigrator
|
||||||
? new AbstractMigrationFileService(this.migrator.id)
|
? new AbstractMigrationFileService(this.migrator.id)
|
||||||
|
|
|
@ -78,6 +78,7 @@ import BaseButton from '@/components/base/BaseButton.vue'
|
||||||
import Message from '@/components/misc/message.vue'
|
import Message from '@/components/misc/message.vue'
|
||||||
import CaldavTokenService from '@/services/caldavToken'
|
import CaldavTokenService from '@/services/caldavToken'
|
||||||
import type CaldavTokenModel from '@/models/caldavToken'
|
import type CaldavTokenModel from '@/models/caldavToken'
|
||||||
|
import { formatDateShort } from '@/helpers/time/formatDate'
|
||||||
|
|
||||||
const copy = useCopyToClipboard()
|
const copy = useCopyToClipboard()
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,7 @@ import {useI18n} from 'vue-i18n'
|
||||||
|
|
||||||
import AccountDeleteService from '@/services/accountDelete'
|
import AccountDeleteService from '@/services/accountDelete'
|
||||||
import {parseDateOrNull} from '@/helpers/parseDateOrNull'
|
import {parseDateOrNull} from '@/helpers/parseDateOrNull'
|
||||||
|
import {formatDateShort, formatDateSince} from '@/helpers/time/formatDate'
|
||||||
import {useTitle} from '@/composables/useTitle'
|
import {useTitle} from '@/composables/useTitle'
|
||||||
import {success} from '@/message'
|
import {success} from '@/message'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue