danielroe / nuxt-time

⏰ SSR-safe time element for Nuxt 3
MIT License
349 stars 15 forks source link

Date differs on server and browser with `time-zone` set. #196

Closed larsjkr closed 9 months ago

larsjkr commented 1 year ago

🐛 The bug

Hi there 👋

Formatted Date differs on server and browser with time-zone set to America/New_York.

<NuxtTime datetime="2023-08-19T02:57:00.000Z" time-zone="America/New_York" />

What happens:

  1. On the server the date is formatted as 18/08/2023
  2. Then (i think while hydration) the date is formatted date as 19/08/2023
  3. After the hydration the date is formatted as 18/08/2023 again.

Have a look on the provided stackblitz for a demo.

🛠ī¸ To reproduce

https://stackblitz.com/edit/github-hjzebn?file=pages%2Findex.vue,tsconfig.json

🌈 Expected behaviour

Formatted Date is the same on server and client.

ℹī¸ Additional context

No response