Commit 56a7d9a 1 parent 42a0ef2 commit 56a7d9a Copy full SHA for 56a7d9a
File tree 1 file changed +4
-5
lines changed
src/client/theme-default/components
1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change 2
2
import { ref , computed , watchEffect , onMounted } from ' vue'
3
3
import { useData } from ' ../composables/data'
4
4
5
- const { theme, page } = useData ()
5
+ const { theme, page, lang } = useData ()
6
6
7
7
const date = computed (() => new Date (page .value .lastUpdated ! ))
8
8
const isoDatetime = computed (() => date .value .toISOString ())
9
9
const datetime = ref (' ' )
10
10
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
14
13
onMounted (() => {
15
14
watchEffect (() => {
16
- datetime .value = date .value .toLocaleString (window . navigator . language )
15
+ datetime .value = date .value .toLocaleString (lang . value )
17
16
})
18
17
})
19
18
</script >
You can’t perform that action at this time.
0 commit comments