Next.js Discord

Discord Forum

Timezones difference when deployed to Vercel

Answered
American Shorthair posted this in #help-forum
Open in Discord
American ShorthairOP
Locally vs Production

Locally is the main goal that I want my website to behaive like. However when visiting the website in production, I get to see different data. As you can see on the last post, the local date OCT 31 11pm which in UTC it is 2025-11-01 06:06:00+00. I purposly made that date so I can make sure that my website works fine with different date.

I am getting the total of the previous month and current month and subtract them to get my data. Production route is not working correctly for me.

You can clearly see the month's spend and from previous month data.
Answered by riský
I use the [x-vercel-ip-timezone](https://vercel.com/docs/headers/request-headers#x-vercel-ip-timezone) request header to see where the user is from and then customise the new Date() tz so its consistent
-# (ie i did it mainly for hydration as it is based of IP, so isnt always accurate)
View full answer

10 Replies

American ShorthairOP
Both the timezones are same. Top one is coming from server and bottom from client.
American ShorthairOP
Anyone faced the same issue?
I use the [x-vercel-ip-timezone](https://vercel.com/docs/headers/request-headers#x-vercel-ip-timezone) request header to see where the user is from and then customise the new Date() tz so its consistent
-# (ie i did it mainly for hydration as it is based of IP, so isnt always accurate)
Answer
American ShorthairOP
Thanks for replying, I am testing it now.
American ShorthairOP
First one is vercel production and second locally, the times are different, that is why it does not give correct data.
American ShorthairOP
now:2025-11-30T10:23:11.866Z
now:2025-11-30T18:23:48.869Z

Second is local which is giving the correct time, vercel is giving my local time but in UTC, is there a code that I can use to solve my issue?
American ShorthairOP
I was able to fix it thanks
Yay so the vercel header worked 🔥
American ShorthairOP
Yeah, you can mark it as answered, thank you!