Skip to content

Commit

Permalink
Closes #148 - correctly apply time zone data
Browse files Browse the repository at this point in the history
Remove unreachable code
  • Loading branch information
u01jmg3 committed Jun 29, 2017
1 parent 5f85732 commit 83c699b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/ICal/ICal.php
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,8 @@ public function iCalDateWithTimeZone(array $event, $key, $format = self::DATE_TI
$duration = end($dateArray);
$dateTime = $this->parseDuration($event['DTSTART'], $duration, null);
} else {
$dateTime = $this->iCalDateToDateTime($dateArray[3], false, true);
$dateTime = new \DateTime($dateArray[1], new \DateTimeZone('UTC'));
$dateTime->setTimezone(new \DateTimeZone($this->calendarTimeZone()));
}

// Force time zone
Expand Down Expand Up @@ -838,7 +839,7 @@ protected function processRecurrences()
// Get Until
$until = strtotime($rrules['UNTIL']);
} elseif (isset($rrules['COUNT'])) {
$countOrig = (is_numeric($rrules['COUNT']) && $rrules['COUNT'] > 1) ? $rrules['COUNT'] : 0;
$countOrig = (is_numeric($rrules['COUNT']) && $rrules['COUNT'] > 1) ? $rrules['COUNT'] : 0;

// Increment count by the number of excluded dates
$countOrig += sizeof($exdates);
Expand Down Expand Up @@ -1459,8 +1460,6 @@ protected function processRecurrences()
$recurrenceEvents = array(); // Reset

break;

$events = (isset($countOrig) && sizeof($events) > $countOrig) ? array_slice($events, 0, $countOrig) : $events; // Ensure we abide by COUNT if defined
}
}
}
Expand Down

0 comments on commit 83c699b

Please sign in to comment.