mirror of
https://github.com/ArthurDanjou/website-old.git
synced 2026-01-28 02:40:33 +01:00
💻 | Format the date in post preview
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
<p class="text-base mt-3 text-gray-700 dark:text-gray-400 text-justify">{{ description }}</p>
|
<p class="text-base mt-3 text-gray-700 dark:text-gray-400 text-justify">{{ description }}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex justify-between">
|
<div class="flex justify-between">
|
||||||
<h5 class="text-base text-gray-700 dark:text-gray-400">{{ date }}</h5>
|
<h5 class="text-base text-gray-700 dark:text-gray-400">{{ formatDate }}</h5>
|
||||||
<h5 class="text-base text-gray-700 dark:text-gray-400">{{ reading_time }} min.</h5>
|
<h5 class="text-base text-gray-700 dark:text-gray-400">{{ reading_time }} min.</h5>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {computed} from "@nuxtjs/composition-api";
|
import {computed, useContext} from "@nuxtjs/composition-api";
|
||||||
|
|
||||||
interface PostHomeProps {
|
interface PostHomeProps {
|
||||||
title: string,
|
title: string,
|
||||||
@@ -71,8 +71,15 @@ export default {
|
|||||||
setup(props: PostHomeProps) {
|
setup(props: PostHomeProps) {
|
||||||
const getBackgroundCover = computed(() => require(`@/assets/images/posts/${props.cover}`))
|
const getBackgroundCover = computed(() => require(`@/assets/images/posts/${props.cover}`))
|
||||||
|
|
||||||
|
const { i18n } = useContext()
|
||||||
|
const formatDate = computed(() => {
|
||||||
|
const [first, second, third]: any = props.date.split('-')
|
||||||
|
return `${first} ${i18n.t(`month.${second}`)} ${third}`
|
||||||
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
getBackgroundCover
|
getBackgroundCover,
|
||||||
|
formatDate
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user