Created
June 3, 2019 14:11
-
-
Save blaadje/7fe33ac6d7485063e1f60295be0f4976 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<span>{{ formattedDate }}</span> | |
</template> | |
<script> | |
import { formatDate } from '@core/helpers' | |
import { mapGetters } from 'vuex' | |
export default { | |
props: { | |
date: { | |
type: String, | |
required: true, | |
}, | |
format: { | |
type: String, | |
default: null, | |
}, | |
}, | |
data () { | |
return { | |
formattedDate: '', | |
} | |
}, | |
computed: { | |
...mapGetters({ | |
locale: 'translations/getLocale', | |
}), | |
}, | |
async created () { | |
this.formattedDate = await formatDate(this.date, this.locale, this.format) | |
}, | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment