Better formatting of the chosen date
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
kolaente 2020-11-25 18:27:17 +01:00
parent 5c29b3e69b
commit 010397d64a
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
2 changed files with 11 additions and 1 deletions

View File

@ -5,7 +5,7 @@
{{ chooseDateLabel }}
</template>
<template v-else>
{{ formatDate(date) }}
{{ formatDateShort(date) }}
</template>
</a>

View File

@ -155,6 +155,13 @@ Vue.directive('focus', focus)
import tooltip from '@/directives/tooltip'
Vue.directive('tooltip', tooltip)
const formatDate = (date, f) => {
if (typeof date === 'string') {
date = new Date(date)
}
return date ? format(date, f) : ''
}
Vue.mixin({
methods: {
formatDateSince: date => {
@ -179,6 +186,9 @@ Vue.mixin({
}
return date ? format(date, 'PPPPpppp') : ''
},
formatDateShort: date => {
return formatDate(date, 'PPpp')
},
error: (e, context, actions = []) => message.error(e, context, actions),
success: (s, context, actions = []) => message.success(s, context, actions),
colorIsDark: colorIsDark,