Skip to content

Commit 56a7d9a

Browse files
authored
fix(theme): use locale lang instead of navigator lang for last updated (#2118)
1 parent 42a0ef2 commit 56a7d9a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/client/theme-default/components/VPDocFooterLastUpdated.vue

+4-5
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@
22
import { ref, computed, watchEffect, onMounted } from 'vue'
33
import { useData } from '../composables/data'
44
5-
const { theme, page } = useData()
5+
const { theme, page, lang } = useData()
66
77
const date = computed(() => new Date(page.value.lastUpdated!))
88
const isoDatetime = computed(() => date.value.toISOString())
99
const datetime = ref('')
1010
11-
// set time on mounted hook because the locale string might be different
12-
// based on end user and will lead to potential hydration mismatch if
13-
// calculated at build time
11+
// set time on mounted hook to avoid hydration mismatch due to
12+
// potential differences in timezones of the server and clients
1413
onMounted(() => {
1514
watchEffect(() => {
16-
datetime.value = date.value.toLocaleString(window.navigator.language)
15+
datetime.value = date.value.toLocaleString(lang.value)
1716
})
1817
})
1918
</script>

0 commit comments

Comments
 (0)