Changeset View
Changeset View
Standalone View
Standalone View
src/view/viewutils.php
| Show All 25 Lines | function phabricator_relative_date($epoch, $user, $on = false) { | ||||
| if ($date === $yesterday) { | if ($date === $yesterday) { | ||||
| return 'yesterday'; | return 'yesterday'; | ||||
| } | } | ||||
| return (($on ? 'on ' : '').$date); | return (($on ? 'on ' : '').$date); | ||||
| } | } | ||||
| function phabricator_time($epoch, $user) { | function phabricator_time($epoch, $user) { | ||||
| $time_key = PhabricatorUserPreferences::PREFERENCE_TIME_FORMAT; | $time_key = PhabricatorTimeFormatSetting::SETTINGKEY; | ||||
| return phabricator_format_local_time( | return phabricator_format_local_time( | ||||
| $epoch, | $epoch, | ||||
| $user, | $user, | ||||
| $user->getPreference($time_key)); | $user->getUserSetting($time_key)); | ||||
| } | } | ||||
| function phabricator_datetime($epoch, $user) { | function phabricator_datetime($epoch, $user) { | ||||
| $time_key = PhabricatorUserPreferences::PREFERENCE_TIME_FORMAT; | $time_key = PhabricatorTimeFormatSetting::SETTINGKEY; | ||||
| return phabricator_format_local_time( | return phabricator_format_local_time( | ||||
| $epoch, | $epoch, | ||||
| $user, | $user, | ||||
| pht('%s, %s', | pht('%s, %s', | ||||
| phutil_date_format($epoch), | phutil_date_format($epoch), | ||||
| $user->getPreference($time_key))); | $user->getUserSetting($time_key))); | ||||
| } | } | ||||
| /** | /** | ||||
| * This function does not usually need to be called directly. Instead, call | * This function does not usually need to be called directly. Instead, call | ||||
| * @{function:phabricator_date}, @{function:phabricator_time}, or | * @{function:phabricator_date}, @{function:phabricator_time}, or | ||||
| * @{function:phabricator_datetime}. | * @{function:phabricator_datetime}. | ||||
| * | * | ||||
| * @param int Unix epoch timestamp. | * @param int Unix epoch timestamp. | ||||
| Show All 38 Lines | |||||