From f97069bd0baed1ed6644b659e07dbd8a9cc6f38c Mon Sep 17 00:00:00 2001 From: Naomi Date: Thu, 29 Aug 2013 15:58:24 -0400 Subject: [PATCH] displaying show list in proper time zone. --- .../application/services/HistoryService.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/services/HistoryService.php b/airtime_mvc/application/services/HistoryService.php index 003ef41a8..75de3b6ae 100644 --- a/airtime_mvc/application/services/HistoryService.php +++ b/airtime_mvc/application/services/HistoryService.php @@ -279,13 +279,13 @@ class Application_Service_HistoryService } } - //need to display the results in the station's timezone. foreach ($rows as $index => &$result) { foreach ($boolCast as $name) { $result[$name] = (bool) $result[$name]; } + //need to display the results in the station's timezone. $dateTime = new DateTime($result["starts"], $timezoneUTC); $dateTime->setTimezone($timezoneLocal); $result["starts"] = $dateTime->format("Y-m-d H:i:s"); @@ -486,6 +486,22 @@ class Application_Service_HistoryService else { $filteredShows = $shows; } + + $timezoneUTC = new DateTimeZone("UTC"); + $timezoneLocal = new DateTimeZone($this->timezone); + + foreach ($filteredShows as &$result) { + + //need to display the results in the station's timezone. + $dateTime = new DateTime($result["starts"], $timezoneUTC); + $dateTime->setTimezone($timezoneLocal); + $result["starts"] = $dateTime->format("Y-m-d H:i:s"); + + $dateTime = new DateTime($result["ends"], $timezoneUTC); + $dateTime->setTimezone($timezoneLocal); + $result["ends"] = $dateTime->format("Y-m-d H:i:s"); + + } return $filteredShows; }