|
|
@ -2,18 +2,17 @@
|
|
|
|
import { ref, computed, watchEffect, onMounted } from 'vue'
|
|
|
|
import { ref, computed, watchEffect, onMounted } from 'vue'
|
|
|
|
import { useData } from '../composables/data'
|
|
|
|
import { useData } from '../composables/data'
|
|
|
|
|
|
|
|
|
|
|
|
const { theme, page } = useData()
|
|
|
|
const { theme, page, lang } = useData()
|
|
|
|
|
|
|
|
|
|
|
|
const date = computed(() => new Date(page.value.lastUpdated!))
|
|
|
|
const date = computed(() => new Date(page.value.lastUpdated!))
|
|
|
|
const isoDatetime = computed(() => date.value.toISOString())
|
|
|
|
const isoDatetime = computed(() => date.value.toISOString())
|
|
|
|
const datetime = ref('')
|
|
|
|
const datetime = ref('')
|
|
|
|
|
|
|
|
|
|
|
|
// set time on mounted hook because the locale string might be different
|
|
|
|
// set time on mounted hook to avoid hydration mismatch due to
|
|
|
|
// based on end user and will lead to potential hydration mismatch if
|
|
|
|
// potential differences in timezones of the server and clients
|
|
|
|
// calculated at build time
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
onMounted(() => {
|
|
|
|
watchEffect(() => {
|
|
|
|
watchEffect(() => {
|
|
|
|
datetime.value = date.value.toLocaleString(window.navigator.language)
|
|
|
|
datetime.value = date.value.toLocaleString(lang.value)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
</script>
|
|
|
|