Skip to content

Commit a1daf2b

Browse files
committed
fix: revert datetime handling
1 parent 22e12b8 commit a1daf2b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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

+6-3
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ const prefix = computed(() => {
2323
return p === true ? 'Last Updated' : p
2424
})
2525
26-
const datetime = computed(() => {
27-
return new Date(page.value.lastUpdated).toLocaleString('en-US')
26+
const datetime = ref('')
27+
onMounted(() => {
28+
// locale string might be different based on end user
29+
// and will lead to potential hydration mismatch if calculated at build time
30+
datetime.value = new Date(page.value.lastUpdated).toLocaleString('en-US')
2831
})
2932
</script>
3033

@@ -33,7 +36,7 @@ const datetime = computed(() => {
3336
display: inline-block;
3437
margin: 0;
3538
line-height: 1.4;
36-
font-size: .9rem;
39+
font-size: 0.9rem;
3740
color: var(--c-text-light);
3841
}
3942

0 commit comments

Comments
 (0)