Skip to content

Commit

Permalink
Bugfix ICS Feed Timezone not adjusted
Browse files Browse the repository at this point in the history
When getting an ICS Feed from Google Calendar the Timezone isn't adjusted. This adjusts it based on the ```$timezone``` static.
  • Loading branch information
muskie9 committed Oct 12, 2014
1 parent dd08d6b commit efce1e6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions code/Calendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,10 @@ public function getFeedEvents($start_date, $end_date) {
// do nothing; dates outside range
} else {
$feedevent->StartDate = $startdatetime->format('Y-m-d');
$feedevent->StartTime = $startdatetime->format('G:i:s');
$feedevent->StartTime = $startdatetime->format('H:i:s');

$feedevent->EndDate = $enddatetime->format('Y-m-d');
$feedevent->EndTime = $enddatetime->format('G:i:s');
$feedevent->EndTime = $enddatetime->format('H:i:s');

$feedevents->push($feedevent);
}
Expand All @@ -381,9 +381,11 @@ public function getFeedEvents($start_date, $end_date) {
}

public function iCalDateToDateTime($date) {
date_default_timezone_set($this->stat('timezone'));
$date = str_replace('T', '', $date);//remove T
$date = str_replace('Z', '', $date);//remove Z
$date = strtotime($date);
$date = $date + date('Z');
return sfDate::getInstance($date);
}

Expand Down

0 comments on commit efce1e6

Please sign in to comment.