diff --git a/airtime_mvc/application/models/airtime/CcSchedule.php b/airtime_mvc/application/models/airtime/CcSchedule.php index db7fb19a7..9b6196f92 100644 --- a/airtime_mvc/application/models/airtime/CcSchedule.php +++ b/airtime_mvc/application/models/airtime/CcSchedule.php @@ -182,19 +182,20 @@ class CcSchedule extends BaseCcSchedule { */ public function setDbStarts($v) { + $utcTimeZone = new DateTimeZone('UTC'); + if ($v instanceof DateTime) { $dt = $v; + $dt->setTimezone($utcTimeZone); } else { // some string/numeric value passed; we normalize that so that we can // validate it. try { if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); + $dt = new DateTime('@'.$v, $utcTimeZone); + } else { - $dt = new DateTime($v); + $dt = new DateTime($v, $utcTimeZone); } } catch (Exception $x) { throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); @@ -216,20 +217,20 @@ class CcSchedule extends BaseCcSchedule { */ public function setDbEnds($v) { - + $utcTimeZone = new DateTimeZone('UTC'); + if ($v instanceof DateTime) { $dt = $v; + $dt->setTimezone($utcTimeZone); } else { // some string/numeric value passed; we normalize that so that we can // validate it. try { if (is_numeric($v)) { // if it's a unix timestamp - $dt = new DateTime('@'.$v, new DateTimeZone('UTC')); - // We have to explicitly specify and then change the time zone because of a - // DateTime bug: http://bugs.php.net/bug.php?id=43003 - $dt->setTimeZone(new DateTimeZone(date_default_timezone_get())); + $dt = new DateTime('@'.$v, $utcTimeZone); + } else { - $dt = new DateTime($v); + $dt = new DateTime($v, $utcTimeZone); } } catch (Exception $x) { throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x); diff --git a/airtime_mvc/application/services/ShowFormService.php b/airtime_mvc/application/services/ShowFormService.php index 96f5dc655..99361281e 100644 --- a/airtime_mvc/application/services/ShowFormService.php +++ b/airtime_mvc/application/services/ShowFormService.php @@ -187,7 +187,7 @@ class Application_Service_ShowFormService 'add_show_end_date_no_repeat' => $showEnd->format("Y-m-d"), 'add_show_end_time' => $showEnd->format("H:i"), 'add_show_duration' => $this->calculateDuration( - $showStart->format("Y-m-d H:i:s"), $showEnd->format("Y-m-d H:i:s")), + $showStart->format("Y-m-d H:i:s"), $showEnd->format("Y-m-d H:i:s"), $timezone), 'add_show_timezone' => $timezone, 'add_show_repeats' => 0));