Is it right to put timzone for PHP equal tisone user?


Came we debate with colleagues: we Have an international project, accordingly, users with different timzone. Apparently in order not to bathe with formatting dates when you run the application timezone for PHP to be equal tisone user (from the settings of the profile definition or IP) method Yii::app->setTimeZone which in turn calls a PHP function date_default_timezone_set). (in principle, suggest here Yii2. How to display a date depending on timeZone? )

I, honestly, seeing this for the first time. In other projects, the timezone was always set equal tisone server and not changed depending on user settings. If you want to take the time to timzone user - it pre-it was translated.

How do you do? What's the correct approach?
July 9th 19 at 13:33
2 answers
July 9th 19 at 13:35
Each user has their own timezone, and even in IPS? What nonsense.
And if it through a proxy? And if it is IPS some Megaphone in the whole of Russia?
You need all this hemorrhoids?
Keep all time in UTC and do not invent bicycles.
If it should show up in the zone - it is best to deal with it the browser - javascript in it really knows is exhibited on the computer time zone, and guessing at the IP,
I agree, but how to do - not for me to decide. - Freeman.Stark80 commented on July 9th 19 at 13:38
July 9th 19 at 13:37
Something like this:
  • To change the area depending on user settings (i.e. when he chooses his own chaosophy belt)
  • Form the date on the client side, ie, JS, view XDate for example
What XDate? MomentJS same - Freeman.Stark80 commented on July 9th 19 at 13:40

Find more questions by tags PHPYii