From a1daf2b8a012a8a248b3a832d80d6933778087d0 Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 29 Dec 2020 11:59:45 -0500 Subject: [PATCH] fix: revert datetime handling --- src/client/theme-default/components/LastUpdated.vue | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/client/theme-default/components/LastUpdated.vue b/src/client/theme-default/components/LastUpdated.vue index 9dfce320756c..d830beee2aed 100644 --- a/src/client/theme-default/components/LastUpdated.vue +++ b/src/client/theme-default/components/LastUpdated.vue @@ -23,8 +23,11 @@ const prefix = computed(() => { return p === true ? 'Last Updated' : p }) -const datetime = computed(() => { - return new Date(page.value.lastUpdated).toLocaleString('en-US') +const datetime = ref('') +onMounted(() => { + // locale string might be different based on end user + // and will lead to potential hydration mismatch if calculated at build time + datetime.value = new Date(page.value.lastUpdated).toLocaleString('en-US') }) @@ -33,7 +36,7 @@ const datetime = computed(() => { display: inline-block; margin: 0; line-height: 1.4; - font-size: .9rem; + font-size: 0.9rem; color: var(--c-text-light); }