diff --git a/resources/sql/patches/045.timezone.sql b/resources/sql/patches/045.timezone.sql index 49c402b25b..a7e317407a 100644 --- a/resources/sql/patches/045.timezone.sql +++ b/resources/sql/patches/045.timezone.sql @@ -1,2 +1,2 @@ ALTER TABLE phabricator_user.user - ADD timezoneIdentifier varchar(255) NOT NULL DEFAULT "America/Los_Angeles"; \ No newline at end of file + ADD timezoneIdentifier varchar(255) NOT NULL; diff --git a/src/applications/people/storage/user/PhabricatorUser.php b/src/applications/people/storage/user/PhabricatorUser.php index c5cbe0a121..5c087df013 100644 --- a/src/applications/people/storage/user/PhabricatorUser.php +++ b/src/applications/people/storage/user/PhabricatorUser.php @@ -27,7 +27,7 @@ class PhabricatorUser extends PhabricatorUserDAO { protected $passwordSalt; protected $passwordHash; protected $profileImagePHID; - protected $timezoneIdentifier; + protected $timezoneIdentifier = ''; protected $consoleEnabled = 0; protected $consoleVisible = 0; @@ -298,4 +298,11 @@ class PhabricatorUser extends PhabricatorUserDAO { return $preferences; } + public function getTimezoneIdentifier() { + // If the user hasn't set one, guess the server's time. + return nonempty( + $this->timezoneIdentifier, + date_default_timezone_get()); + } + }