From 37a0c271f6eec14e47dedb2f825ae6b88a90dfcc Mon Sep 17 00:00:00 2001 From: drigato Date: Thu, 3 Oct 2013 18:02:15 -0400 Subject: [PATCH] CC-5359: Update show fails sometimes with overlapping check Some DateTime objects were not getting created in correct timezone Used format() to get the day of week value instead of getTimestamp() getTimestamp() sometimes returns the wrong value --- airtime_mvc/application/forms/AddShowWhen.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/airtime_mvc/application/forms/AddShowWhen.php b/airtime_mvc/application/forms/AddShowWhen.php index 62b8004c5..518b07405 100644 --- a/airtime_mvc/application/forms/AddShowWhen.php +++ b/airtime_mvc/application/forms/AddShowWhen.php @@ -168,9 +168,9 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm if ($valid) { $utc = new DateTimeZone('UTC'); $showTimezone = new DateTimeZone($formData["add_show_timezone"]); - $show_start = new DateTime($start_time); + $show_start = new DateTime($start_time, $showTimezone); $show_start->setTimezone($utc); - $show_end = new DateTime($end_time); + $show_end = new DateTime($end_time, $showTimezone); $show_end->setTimezone($utc); if ($formData["add_show_repeats"]) { @@ -188,7 +188,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm } elseif (!$formData["add_show_no_end"]) { $popUntil = $formData["add_show_end_date"]." ".$formData["add_show_end_time"]; - $populateUntilDateTime = new DateTime($popUntil); + $populateUntilDateTime = new DateTime($popUntil, $showTimezone); $populateUntilDateTime->setTimezone($utc); } @@ -216,7 +216,7 @@ class Application_Form_AddShowWhen extends Zend_Form_SubForm * Do this for each show day */ if (!$overlapping) { - $startDow = date("w", $show_start->getTimestamp()); + $startDow = $show_start->format("w"); if (!isset($formData['add_show_day_check'])) { return false;