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