diff --git a/airtime_mvc/application/controllers/ScheduleController.php b/airtime_mvc/application/controllers/ScheduleController.php index e97b2d7fc..9ce53ca02 100644 --- a/airtime_mvc/application/controllers/ScheduleController.php +++ b/airtime_mvc/application/controllers/ScheduleController.php @@ -900,15 +900,19 @@ class ScheduleController extends Zend_Controller_Action $startParam = $this->_getParam('startTime'); $endParam = $this->_getParam('endTime'); - $startDateTime = new DateTime($startParam); - $endDateTime = new DateTime($endParam); + try{ + $startDateTime = new DateTime($startParam); + $endDateTime = new DateTime($endParam); - $UTCStartDateTime = $startDateTime->setTimezone(new DateTimeZone('UTC')); - $UTCEndDateTime = $endDateTime->setTimezone(new DateTimeZone('UTC')); + $UTCStartDateTime = $startDateTime->setTimezone(new DateTimeZone('UTC')); + $UTCEndDateTime = $endDateTime->setTimezone(new DateTimeZone('UTC')); - $duration = $UTCEndDateTime->diff($UTCStartDateTime); + $duration = $UTCEndDateTime->diff($UTCStartDateTime); - $result = $duration->format('%r%Hh %Im'); + $result = $duration->format('%r%Hh %Im'); + }catch (Exception $e){ + $result = "Invalid Date"; + } echo Zend_Json::encode($result); exit(); diff --git a/airtime_mvc/application/views/scripts/form/add-show-when.phtml b/airtime_mvc/application/views/scripts/form/add-show-when.phtml index 6f3591ac6..124aebee3 100644 --- a/airtime_mvc/application/views/scripts/form/add-show-when.phtml +++ b/airtime_mvc/application/views/scripts/form/add-show-when.phtml @@ -46,6 +46,7 @@
element->getElement('add_show_duration') ?> +
element->getElement('add_show_duration')->hasErrors()){ ?>