Closed reslear closed 1 year ago
oh fixed simple add v-if:
<div v-if="item.updatedAt">
{{ $df(item.updatedAt, 'LL') }}
</div>
I think item.updatedAt
is undefined on server side
Uh, that didn't help, so it turns out
it does hydration on the server with the selected language - as if it caches only the first one, when you refresh the page with another language - there is already a hydration problem.
also same is add:
definePageMeta({
key: (route) => route.fullPath,
})
Can you provide a minimal repo?
https://stackblitz.com/edit/nuxt-dayjs-i18n-xtqkqq
hu
prefix_except_default
update url and reload pagehttps://github.com/GaborTorma/nuxt-dayjs-i18n/assets/12596485/1cc4dcbb-93c0-443c-a540-8ed3a5ef46cb
temporally worked solution
<time :datetime="item.updatedAt">
<ClientOnly :fallback="item.updatedAt">{{ $df(item.updatedAt, 'LL') }}</ClientOnly>
</time>
Unfortunately the Day.js is not SSR ready. Server-side generated with the default locale.
I found a solution. I will release a new version in few days.
Fixed in v.2.0.0 Make sure don't define defaultLocale in dayjs config. I comes from i18n.locale.
Use dayjs-nuxt@2.1.9
Updated, works like a charm :) you are awesome !
used syntax: