CC-3478: Calendar->Show has some inconsistencies on special Days (e.g.

switching to Daylight Saving Time)

- added exception handling
This commit is contained in:
James 2012-04-26 10:56:08 -04:00
parent a9d125bc4d
commit 0fe4478bb5
1 changed files with 10 additions and 6 deletions

View File

@ -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();