CC-5594 : Remove all date_default_timezone_get()

missed a place to set show timezone,
setting UTC timezone in CcSchedule, very important!!
This commit is contained in:
Naomi 2013-12-05 15:57:00 -05:00
parent b1842fff34
commit ec6a991090
2 changed files with 13 additions and 12 deletions

View File

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

View File

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