Skip to content

Instantly share code, notes, and snippets.

@blaadje
Created June 3, 2019 14:11
Show Gist options
  • Save blaadje/7fe33ac6d7485063e1f60295be0f4976 to your computer and use it in GitHub Desktop.
Save blaadje/7fe33ac6d7485063e1f60295be0f4976 to your computer and use it in GitHub Desktop.
<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