fix: fix dayjs date format (#87)

This commit is contained in:
João Peixoto
2021-03-16 19:46:29 +00:00
committed by GitHub
parent 05c30302bc
commit b8b20eff80
3 changed files with 15 additions and 9 deletions
@@ -51,6 +51,7 @@
<script>
import dayjs from 'dayjs'
import utc from 'dayjs/plugin/utc'
import Breadcrumbs from '@theme/components/Breadcrumbs'
import LazyImage from '@theme/components/base/LazyImage'
import PostAuthor from '@theme/components/blog/PostAuthor'
@@ -90,9 +91,10 @@ export default {
},
computed: {
resolvedDate() {
return dayjs(this.date).format(
this.$themeLocaleConfig.dateFormat || 'YYYY-MM-DD'
)
dayjs.extend(utc)
return dayjs
.utc(this.date)
.format(this.$themeLocaleConfig.dateFormat || 'YYYY-MM-DD')
},
resolvedTags() {
if (!this.tags || Array.isArray(this.tags)) return this.tags
@@ -64,6 +64,7 @@
<script>
import dayjs from 'dayjs'
import utc from 'dayjs/plugin/utc'
import PostTag from '@theme/components/blog/PostTag'
import PostAuthor from '@theme/components/blog/PostAuthor'
import UnstyledLink from '@theme/components/UnstyledLink'
@@ -115,9 +116,10 @@ export default {
},
computed: {
resolvedDate() {
return dayjs(this.date).format(
this.$themeLocaleConfig.dateFormat || 'YYYY-MM-DD'
)
dayjs.extend(utc)
return dayjs
.utc(this.date)
.format(this.$themeLocaleConfig.dateFormat || 'YYYY-MM-DD')
},
resolvedTags() {
if (!this.tags || Array.isArray(this.tags)) return this.tags
@@ -81,6 +81,7 @@
import { mapState } from 'vuex'
import dayjs from 'dayjs'
import utc from 'dayjs/plugin/utc'
import UnstyledLink from '@theme/components/UnstyledLink'
import PostSocials from '@theme/components/blog/PostSocials.vue'
import PostTag from '@theme/components/blog/PostTag'
@@ -120,9 +121,10 @@ export default {
: `https://www.youtube.com/embed/${id}?${start ? `start=${start}` : ''}`
},
resolvedDate() {
return dayjs(this.videoModalCard.date).format(
this.$themeLocaleConfig.dateFormat || 'YYYY-MM-DD'
)
dayjs.extend(utc)
return dayjs
.utc(this.date)
.format(this.$themeLocaleConfig.dateFormat || 'YYYY-MM-DD')
},
resolvedTags() {
if (