Make event lists respect the user preference for time format.
Summary: Ref T8362, Make event lists respect the user preference for time format Test Plan: Set time format preference to 24-hour format, open Calendar month view, all events should show time tips in 24-hour format. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Maniphest Tasks: T8362 Differential Revision: https://secure.phabricator.com/D13290
This commit is contained in:
		| @@ -141,6 +141,12 @@ final class PHUICalendarListView extends AphrontTagView { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   private function getEventTooltip(AphrontCalendarEventView $event) { |   private function getEventTooltip(AphrontCalendarEventView $event) { | ||||||
|  |     $viewer = $this->getUser(); | ||||||
|  |     $preferences = $viewer->loadPreferences(); | ||||||
|  |     $time_pref = $preferences->getPreference( | ||||||
|  |       PhabricatorUserPreferences::PREFERENCE_TIME_FORMAT, | ||||||
|  |       'g:i A'); | ||||||
|  |  | ||||||
|     Javelin::initBehavior('phabricator-tooltips'); |     Javelin::initBehavior('phabricator-tooltips'); | ||||||
|  |  | ||||||
|     $start = id(AphrontFormDateControlValue::newFromEpoch( |     $start = id(AphrontFormDateControlValue::newFromEpoch( | ||||||
| @@ -166,13 +172,13 @@ final class PHUICalendarListView extends AphrontTagView { | |||||||
|       if ($start->getValueDate() == $end->getValueDate()) { |       if ($start->getValueDate() == $end->getValueDate()) { | ||||||
|         $tip = pht( |         $tip = pht( | ||||||
|           '%s - %s', |           '%s - %s', | ||||||
|           $start->getValueAsFormat('g:i A'), |           $start->getValueAsFormat($time_pref), | ||||||
|           $end->getValueAsFormat('g:i A')); |           $end->getValueAsFormat($time_pref)); | ||||||
|       } else { |       } else { | ||||||
|         $tip = pht( |         $tip = pht( | ||||||
|           '%s - %s', |           '%s - %s', | ||||||
|           $start->getValueAsFormat('M j, Y, g:i A'), |           $start->getValueAsFormat('M j, Y, '.$time_pref), | ||||||
|           $end->getValueAsFormat('M j, Y, g:i A')); |           $end->getValueAsFormat('M j, Y, '.$time_pref)); | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     return $tip; |     return $tip; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 lkassianik
					lkassianik