From e6b6c42f76f89e8419501ccd58644a42cac69528 Mon Sep 17 00:00:00 2001 From: lkassianik Date: Mon, 15 Jun 2015 10:02:43 -0700 Subject: [PATCH] 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 --- src/view/phui/calendar/PHUICalendarListView.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/view/phui/calendar/PHUICalendarListView.php b/src/view/phui/calendar/PHUICalendarListView.php index 1e0639262d..80468dcb62 100644 --- a/src/view/phui/calendar/PHUICalendarListView.php +++ b/src/view/phui/calendar/PHUICalendarListView.php @@ -141,6 +141,12 @@ final class PHUICalendarListView extends AphrontTagView { } 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'); $start = id(AphrontFormDateControlValue::newFromEpoch( @@ -166,13 +172,13 @@ final class PHUICalendarListView extends AphrontTagView { if ($start->getValueDate() == $end->getValueDate()) { $tip = pht( '%s - %s', - $start->getValueAsFormat('g:i A'), - $end->getValueAsFormat('g:i A')); + $start->getValueAsFormat($time_pref), + $end->getValueAsFormat($time_pref)); } else { $tip = pht( '%s - %s', - $start->getValueAsFormat('M j, Y, g:i A'), - $end->getValueAsFormat('M j, Y, g:i A')); + $start->getValueAsFormat('M j, Y, '.$time_pref), + $end->getValueAsFormat('M j, Y, '.$time_pref)); } } return $tip;