Better formatting of the chosen date
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
5c29b3e69b
commit
010397d64a
|
@ -5,7 +5,7 @@
|
|||
{{ chooseDateLabel }}
|
||||
</template>
|
||||
<template v-else>
|
||||
{{ formatDate(date) }}
|
||||
{{ formatDateShort(date) }}
|
||||
</template>
|
||||
</a>
|
||||
|
||||
|
|
10
src/main.js
10
src/main.js
|
@ -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,
|
||||
|
|
Reference in New Issue