From 4d77d14d3335b1071cfd36ea5bc1f3b73ae3be24 Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Wed, 11 Dec 2013 15:54:13 -0500 Subject: [PATCH] CC-5627: Check all Application_Common_DateHelper calculations that use timezone. * Removed strtotime usage from AddShowRepeats.php --- .../application/forms/AddShowRepeats.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/airtime_mvc/application/forms/AddShowRepeats.php b/airtime_mvc/application/forms/AddShowRepeats.php index 6045c3d78..a8179ccd8 100644 --- a/airtime_mvc/application/forms/AddShowRepeats.php +++ b/airtime_mvc/application/forms/AddShowRepeats.php @@ -83,8 +83,8 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm } public function isValid($formData) { - if (parent::isValid($formData)) { - return $this->checkReliantFields($formData); + if (parent::isValid($formData)) { + return $this->checkReliantFields($formData); } else { return false; } @@ -95,15 +95,18 @@ class Application_Form_AddShowRepeats extends Zend_Form_SubForm if (!$formData['add_show_no_end']) { $start_timestamp = $formData['add_show_start_date']; $end_timestamp = $formData['add_show_end_date']; - - $start_epoch = strtotime($start_timestamp); - $end_epoch = strtotime($end_timestamp); - - if ($end_epoch < $start_epoch) { + $showTimeZone = new DateTimeZone($formData['add_show_timezone']); + + //We're assuming all data is valid at this point (timezone, etc.). + + $startDate = new DateTime($start_timestamp, $showTimeZone); + $endDate = new DateTime($end_timestamp, $showTimeZone); + + if ($endDate < $startDate) { $this->getElement('add_show_end_date')->setErrors(array(_('End date must be after start date'))); - return false; } + return true; } if (!isset($formData['add_show_day_check'])) {