Replies: 1 comment 2 replies
-
That might be the case, but have you checked which time zone the server uses? I.e. you're formatting a date (which might be referencing a particular time zone), but you're formatting it into the time zone of the target environment. The fact that a date string might include a time zone does not affect the formatting in any way—it's just a representation of how a particular moment in time is stored. By default, the time zone of the server is used—you might want to pick an explicit time zone if the result does not match your expectation. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am not sure if this expected but I am seeing inconsistent behaviour across date/time formatters when it comes to timezones
For example, in a client component (not pre-rendered, etc.), I have this piece of code:
When using Next.js dev server, they all check out fine:
(ignore the slight differences, i didn't bother to pass in the locale to
Intl.DateTimeFormat
)But when I deploy this to Vercel, the
useFormatter()
seems to return timestamps in UTC. Please note the theDate
object is still carrying the timezone information andIntl.DateTimeFormat
is behaving correctly.Versions:
Beta Was this translation helpful? Give feedback.
All reactions