Alanaktion / phproject

A high performance full-featured project management system
https://www.phproject.org
GNU General Public License v3.0
389 stars 106 forks source link

DateTimeZone::__construct(): #372

Closed starsnet closed 5 years ago

starsnet commented 5 years ago

Hi, all

I updated phpproject. And now i have error:

500 Internal Server Error

DateTimeZone::__construct(): Unknown or bad timezone (Moscow) [.../public_html/projects/app/helper/view.php:308]

what need to do?)

starsnet commented 5 years ago

Can this code return timezone in format Zone/City ? Example, Europe/Moscow.

In fact, this code returns only the city(Moscow, for me). Without zone (Europe, for me).

public function timeoffset() { $f3 = \Base::instance(); if ($f3->exists("site.timeoffset")) { return $f3->get("site.timeoffset"); } else { $tz = $f3->get("site.timezone"); $dtzLocal = new \DateTimeZone($tz); $dtLocal = new \DateTime("now", $dtzLocal); $offset = $dtzLocal->getOffset($dtLocal); $f3->set("site.timeoffset", $offset); } return $offset;

starsnet commented 5 years ago

the question is closed. Solution: it is necessary in the database (section config) to change the value of the City, to the Zone / City. I upgraded from version 1.3.1 to 1.7.6. Apparently, the structure and values in the database have changed in different versions.