Using getLocalTimeZone() in RSC's? #7042
Unanswered
J4v4Scr1pt
asked this question in
Q&A
Replies: 1 comment 3 replies
-
You should be able to set a cookie, then read it from the header in RSCs: https://nextjs.org/docs/app/api-reference/functions/cookies |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When you use methods like
parseAbsolute(), today(), isToday()
etc. they require you to provide an timeZone. The docs suggestgetLocalTimeZone()
.Using NextJs and creating RSC's you may sometime need use these methods and getLocalTimeZone uses
new Intl.DateTimeFormat().resolvedOptions().timeZone
under the hood. I would think this uses the server timeZone then.What is the suggested way of providing the correct user timeZone doing SSR?
Maybe a stupid question, but I would to hear what you think. 😅
Beta Was this translation helpful? Give feedback.
All reactions