Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/storage/PhabricatorUser.php
Show First 20 Lines • Show All 749 Lines • ▼ Show 20 Lines | if (strlen($this->getRealName())) { | ||||
return $this->getUsername(); | return $this->getUsername(); | ||||
} | } | ||||
} | } | ||||
public function getTimeZone() { | public function getTimeZone() { | ||||
return new DateTimeZone($this->getTimezoneIdentifier()); | return new DateTimeZone($this->getTimezoneIdentifier()); | ||||
} | } | ||||
public function getTimeZoneOffset() { | |||||
$timezone = $this->getTimeZone(); | |||||
$now = new DateTime('@'.PhabricatorTime::getNow()); | |||||
$offset = $timezone->getOffset($now); | |||||
// Javascript offsets are in minutes and have the opposite sign. | |||||
$offset = -(int)($offset / 60); | |||||
return $offset; | |||||
} | |||||
public function formatShortDateTime($when, $now = null) { | public function formatShortDateTime($when, $now = null) { | ||||
if ($now === null) { | if ($now === null) { | ||||
$now = PhabricatorTime::getNow(); | $now = PhabricatorTime::getNow(); | ||||
} | } | ||||
try { | try { | ||||
$when = new DateTime('@'.$when); | $when = new DateTime('@'.$when); | ||||
$now = new DateTime('@'.$now); | $now = new DateTime('@'.$now); | ||||
▲ Show 20 Lines • Show All 616 Lines • Show Last 20 Lines |