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:
parent
b1842fff34
commit
ec6a991090
|
@ -182,19 +182,20 @@ class CcSchedule extends BaseCcSchedule {
|
||||||
*/
|
*/
|
||||||
public function setDbStarts($v)
|
public function setDbStarts($v)
|
||||||
{
|
{
|
||||||
|
$utcTimeZone = new DateTimeZone('UTC');
|
||||||
|
|
||||||
if ($v instanceof DateTime) {
|
if ($v instanceof DateTime) {
|
||||||
$dt = $v;
|
$dt = $v;
|
||||||
|
$dt->setTimezone($utcTimeZone);
|
||||||
} else {
|
} else {
|
||||||
// some string/numeric value passed; we normalize that so that we can
|
// some string/numeric value passed; we normalize that so that we can
|
||||||
// validate it.
|
// validate it.
|
||||||
try {
|
try {
|
||||||
if (is_numeric($v)) { // if it's a unix timestamp
|
if (is_numeric($v)) { // if it's a unix timestamp
|
||||||
$dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
|
$dt = new DateTime('@'.$v, $utcTimeZone);
|
||||||
// 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()));
|
|
||||||
} else {
|
} else {
|
||||||
$dt = new DateTime($v);
|
$dt = new DateTime($v, $utcTimeZone);
|
||||||
}
|
}
|
||||||
} catch (Exception $x) {
|
} catch (Exception $x) {
|
||||||
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $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)
|
public function setDbEnds($v)
|
||||||
{
|
{
|
||||||
|
$utcTimeZone = new DateTimeZone('UTC');
|
||||||
|
|
||||||
if ($v instanceof DateTime) {
|
if ($v instanceof DateTime) {
|
||||||
$dt = $v;
|
$dt = $v;
|
||||||
|
$dt->setTimezone($utcTimeZone);
|
||||||
} else {
|
} else {
|
||||||
// some string/numeric value passed; we normalize that so that we can
|
// some string/numeric value passed; we normalize that so that we can
|
||||||
// validate it.
|
// validate it.
|
||||||
try {
|
try {
|
||||||
if (is_numeric($v)) { // if it's a unix timestamp
|
if (is_numeric($v)) { // if it's a unix timestamp
|
||||||
$dt = new DateTime('@'.$v, new DateTimeZone('UTC'));
|
$dt = new DateTime('@'.$v, $utcTimeZone);
|
||||||
// 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()));
|
|
||||||
} else {
|
} else {
|
||||||
$dt = new DateTime($v);
|
$dt = new DateTime($v, $utcTimeZone);
|
||||||
}
|
}
|
||||||
} catch (Exception $x) {
|
} catch (Exception $x) {
|
||||||
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
|
throw new PropelException('Error parsing date/time value: ' . var_export($v, true), $x);
|
||||||
|
|
|
@ -187,7 +187,7 @@ class Application_Service_ShowFormService
|
||||||
'add_show_end_date_no_repeat' => $showEnd->format("Y-m-d"),
|
'add_show_end_date_no_repeat' => $showEnd->format("Y-m-d"),
|
||||||
'add_show_end_time' => $showEnd->format("H:i"),
|
'add_show_end_time' => $showEnd->format("H:i"),
|
||||||
'add_show_duration' => $this->calculateDuration(
|
'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_timezone' => $timezone,
|
||||||
'add_show_repeats' => 0));
|
'add_show_repeats' => 0));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue