framework icon indicating copy to clipboard operation
framework copied to clipboard

Unable to set default timezone

Open DarkKnight1992 opened this issue 9 years ago • 12 comments

I am trying to set the default timezone but nothing seems to works

i have tried setting env variable and total config independently

$ TZ=Europe/Amsterdam node debug.js
AND
default-timezone          : Europe/Kiev
AND 
default-timezone          : Europe/Amsterdam

but nothing works

DarkKnight1992 avatar Nov 23 '17 11:11 DarkKnight1992

Hmm, there is a problem in Node.js: https://stackoverflow.com/questions/8083410/how-can-i-set-the-default-timezone-in-node-js

Maybe this will work on Linux:

env TZ='Europe/Amsterdam' node server.js

But I don't recommend to change UTC, the work with UTC is better than some local timezone.

petersirka avatar Nov 23 '17 13:11 petersirka

Well here the catch i am trying to make it utc time but it not working

DarkKnight1992 avatar Nov 23 '17 14:11 DarkKnight1992

UTC has great benefits:

  • each client sends data in UTC format (JSON uses UTC time)
  • client converts received dates in UTC to LocalTime automatically (JSON uses UTC time)
  • time is universal between all continents

petersirka avatar Nov 23 '17 14:11 petersirka

Yes i agree that's why we are trying to make new Date() object to always return utc time, currently its using the servers time instead of utc.

DarkKnight1992 avatar Nov 23 '17 15:11 DarkKnight1992

it's problem with yours OS. Node.js always using Tz settings, many OS use UTC format by default. I think with code should work fine: export TZ=utc nodejs server.js

webdesus avatar Nov 23 '17 17:11 webdesus

@webdesus i have tried that didnt work for us. And if its an OS issue, how can i fix it ?

DarkKnight1992 avatar Nov 23 '17 18:11 DarkKnight1992

Which OS you use?

webdesus avatar Nov 23 '17 21:11 webdesus

windows 10 and centos 7 behaving same

DarkKnight1992 avatar Nov 24 '17 09:11 DarkKnight1992

I can not believe it. Do you can send me screen? This is my screen image

webdesus avatar Nov 24 '17 10:11 webdesus

Maybe you confused the client side with the backend side ...

webdesus avatar Nov 24 '17 16:11 webdesus

@petersirka i think we can might close this issue, cuz It's not problem total.js

webdesus avatar Nov 27 '17 09:11 webdesus

Yes, you're right.

petersirka avatar Nov 27 '17 09:11 petersirka