@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make dates/times more concise in Diffusion

Summary: I think I like this better -- but maybe right-aligned?

Test Plan:
{F1180295}

{F1180296}

Reviewers: chad

Reviewed By: chad

Differential Revision: https://secure.phabricator.com/D15495

+43 -9
+1 -1
src/applications/diffusion/controller/DiffusionLastModifiedController.php
··· 103 103 $modified = DiffusionView::linkCommit( 104 104 $drequest->getRepository(), 105 105 $commit->getCommitIdentifier()); 106 - $date = phabricator_datetime($epoch, $viewer); 106 + $date = $viewer->formatShortDateTime($epoch); 107 107 } else { 108 108 $modified = ''; 109 109 $date = '';
+2 -2
src/applications/diffusion/view/DiffusionBranchTableView.php
··· 39 39 $commit = idx($commits, $branch->getCommitIdentifier()); 40 40 if ($commit) { 41 41 $details = $commit->getSummary(); 42 - $datetime = phabricator_datetime($commit->getEpoch(), $viewer); 42 + $datetime = $viewer->formatShortDateTime($commit->getEpoch()); 43 43 $buildable = idx($buildables, $commit->getPHID()); 44 44 if ($buildable) { 45 45 $build_status = $this->renderBuildable($buildable); ··· 147 147 '', 148 148 'wide', 149 149 '', 150 - '', 150 + 'right', 151 151 )); 152 152 $view->setColumnVisibility( 153 153 array(
+1 -1
src/applications/diffusion/view/DiffusionBrowseTableView.php
··· 129 129 '', 130 130 '', 131 131 'wide', 132 - '', 132 + 'right', 133 133 )); 134 134 $view->setColumnVisibility( 135 135 array(
+2 -2
src/applications/diffusion/view/DiffusionHistoryTableView.php
··· 95 95 $epoch = $history->getEpoch(); 96 96 97 97 if ($epoch) { 98 - $committed = phabricator_datetime($epoch, $viewer); 98 + $committed = $viewer->formatShortDateTime($epoch); 99 99 } else { 100 100 $committed = null; 101 101 } ··· 195 195 '', 196 196 '', 197 197 'wide', 198 - '', 198 + 'right', 199 199 )); 200 200 $view->setColumnVisibility( 201 201 array(
+2 -2
src/applications/diffusion/view/DiffusionPushLogListView.php
··· 88 88 // TODO: Make these human-readable. 89 89 $log->getChangeFlags(), 90 90 $log->getPushEvent()->getRejectCode(), 91 - phabricator_datetime($log->getEpoch(), $viewer), 91 + $viewer->formatShortDateTime($log->getEpoch()), 92 92 ); 93 93 } 94 94 ··· 119 119 'wide', 120 120 'n', 121 121 'n', 122 - 'date', 122 + 'right', 123 123 )); 124 124 125 125 return $table;
+3 -1
src/applications/diffusion/view/DiffusionTagListView.php
··· 28 28 public function render() { 29 29 $drequest = $this->getDiffusionRequest(); 30 30 $repository = $drequest->getRepository(); 31 + $viewer = $this->getViewer(); 31 32 32 33 $buildables = $this->loadBuildables($this->commits); 33 34 $has_builds = false; ··· 100 101 $build, 101 102 $author, 102 103 $description, 103 - phabricator_datetime($tag->getEpoch(), $this->getViewer()), 104 + $viewer->formatShortDateTime($tag->getEpoch()), 104 105 ); 105 106 } 106 107 ··· 123 124 '', 124 125 '', 125 126 'wide', 127 + 'right', 126 128 )) 127 129 ->setColumnVisibility( 128 130 array(
+32
src/applications/people/storage/PhabricatorUser.php
··· 742 742 return new DateTimeZone($this->getTimezoneIdentifier()); 743 743 } 744 744 745 + public function formatShortDateTime($when, $now = null) { 746 + if ($now === null) { 747 + $now = PhabricatorTime::getNow(); 748 + } 749 + 750 + try { 751 + $when = new DateTime('@'.$when); 752 + $now = new DateTime('@'.$now); 753 + } catch (Exception $ex) { 754 + return null; 755 + } 756 + 757 + $zone = $this->getTimeZone(); 758 + 759 + $when->setTimeZone($zone); 760 + $now->setTimeZone($zone); 761 + 762 + if ($when->format('Y') !== $now->format('Y')) { 763 + // Different year, so show "Feb 31 2075". 764 + $format = 'M j Y'; 765 + } else if ($when->format('Ymd') !== $now->format('Ymd')) { 766 + // Same year but different month and day, so show "Feb 31". 767 + $format = 'M j'; 768 + } else { 769 + // Same year, month and day so show a time of day. 770 + $pref_time = PhabricatorUserPreferences::PREFERENCE_TIME_FORMAT; 771 + $format = $this->getPreference($pref_time); 772 + } 773 + 774 + return $when->format($format); 775 + } 776 + 745 777 public function getPreference($key) { 746 778 $preferences = $this->loadPreferences(); 747 779