mirror of
https://github.com/tachiyomiorg/website.git
synced 2024-10-31 23:15:05 +01:00
Fix the hydration issue on release date (#31)
* Fix the hydration issue on release date. * Show the exact date while rendering instead.
This commit is contained in:
parent
3dca7e2dca
commit
e57a37e9cc
@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, toRefs } from "vue"
|
||||
import { computed, onMounted, ref, toRefs } from "vue"
|
||||
import moment from "moment"
|
||||
import { type AppRelease, data as release } from "../data/release.data"
|
||||
|
||||
@ -11,10 +11,20 @@ const momentInfo = computed(() => ({
|
||||
exact: moment(release[type.value].published_at).format("dddd, MMMM Do YYYY [at] HH:mm"),
|
||||
iso: release[type.value].published_at ?? undefined,
|
||||
}))
|
||||
|
||||
// Mimic the <ClientOnly /> behavior to show custom text while rendering.
|
||||
const show = ref(false)
|
||||
|
||||
onMounted(() => {
|
||||
show.value = true
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<time :datetime="momentInfo.iso" :title="momentInfo.exact">
|
||||
<time v-if="show" :datetime="momentInfo.iso" :title="momentInfo.exact">
|
||||
{{ momentInfo.relative }}
|
||||
</time>
|
||||
<time v-else :datetime="momentInfo.iso">
|
||||
{{ momentInfo.exact }}
|
||||
</time>
|
||||
</template>
|
||||
|
Loading…
Reference in New Issue
Block a user