Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/RRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -1519,7 +1519,8 @@ protected function iterate($reset = false)
if ( ! isset($filtered_set[$tmp]) ) {
$occurrence = \DateTime::createFromFormat(
'Y z',
"$year $yearday"
"$year $yearday",
$this->dtstart->getTimezone()
);
$occurrence->setTime($time[0], $time[1], $time[2]);
$filtered_set[$tmp] = $occurrence;
Expand Down Expand Up @@ -1554,7 +1555,7 @@ protected function iterate($reset = false)
else {
// normal loop, without BYSETPOS
while ( ($yearday = current($dayset)) !== false ) {
$occurrence = \DateTime::createFromFormat('Y z', "$year $yearday");
$occurrence = \DateTime::createFromFormat('Y z', "$year $yearday",$this->dtstart->getTimezone());

while ( ($time = current($timeset)) !== false ) {
$occurrence->setTime($time[0], $time[1], $time[2]);
Expand Down
156 changes: 91 additions & 65 deletions tests/RRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -756,17 +756,43 @@ public function rfcExamples()
return array(
// Daily, for 10 occurrences.
array(
array('freq' => 'daily', 'count' => 10, 'dtstart' => '1997-09-02 09:00:00'),
array(date_create('1997-09-02 09:00:00'),
date_create('1997-09-03 09:00:00'),
date_create('1997-09-04 09:00:00'),
date_create('1997-09-05 09:00:00'),
date_create('1997-09-06 09:00:00'),
date_create('1997-09-07 09:00:00'),
date_create('1997-09-08 09:00:00'),
date_create('1997-09-09 09:00:00'),
date_create('1997-09-10 09:00:00'),
date_create('1997-09-11 09:00:00'))
array('freq' => 'daily', 'count' => 10, 'dtstart' => date_create('1997-09-02 09:00:00',new DateTimeZone('Australia/Sydney'))),
array(date_create('1997-09-02 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-04 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-05 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-06 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-07 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-08 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-09 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-10 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-11 09:00:00',new DateTimeZone('Australia/Sydney')))
),
array(
array('freq' => 'daily', 'count' => 10, 'dtstart' => date_create('2016-10-02 09:00:00',new DateTimeZone('Australia/Sydney'))),
array(date_create('2016-10-02 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('2016-10-03 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('2016-10-04 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('2016-10-05 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('2016-10-06 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('2016-10-07 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('2016-10-08 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('2016-10-09 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('2016-10-10 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('2016-10-11 09:00:00',new DateTimeZone('Australia/Sydney')))
),
array(
array('freq' => 'daily', 'count' => 10, 'dtstart' => date_create('2016-04-02 09:00:00',new DateTimeZone('Australia/Sydney'))),
array(date_create('2016-04-02 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('2016-04-03 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('2016-04-04 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('2016-04-05 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('2016-04-06 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('2016-04-07 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('2016-04-08 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('2016-04-09 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('2016-04-10 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('2016-04-11 09:00:00',new DateTimeZone('Australia/Sydney')))
),
// Daily until December 24, 1997
array(
Expand Down Expand Up @@ -1227,65 +1253,65 @@ public function rfcExamples()
),
// Every hour and a half for 4 occurrences.
array(
array('freq' => 'MINUTELY', 'interval' => 90, 'count' => 4, 'dtstart' => '1997-09-02 09:00:00'),
array(date_create('1997-09-02 09:00:00'),
date_create('1997-09-02 10:30:00'),
date_create('1997-09-02 12:00:00'),
date_create('1997-09-02 13:30:00'))
array('freq' => 'MINUTELY', 'interval' => 90, 'count' => 4, 'dtstart' => date_create('1997-09-02 09:00:00',new DateTimeZone('Australia/Sydney'))),
array(date_create('1997-09-02 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 10:30:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 12:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 13:30:00',new DateTimeZone('Australia/Sydney')))
),
// Every 20 minutes from 9:00 AM to 4:40 PM for two days.
array(
array('freq' => 'MINUTELY', 'interval' => 20, 'count' => 48,
'byhour' => range(9,16), 'byminute' => '0,20,40',
'dtstart' => '1997-09-02 09:00:00'), array(
date_create('1997-09-02 09:00:00'),
date_create('1997-09-02 09:20:00'),
date_create('1997-09-02 09:40:00'),
date_create('1997-09-02 10:00:00'),
date_create('1997-09-02 10:20:00'),
date_create('1997-09-02 10:40:00'),
date_create('1997-09-02 11:00:00'),
date_create('1997-09-02 11:20:00'),
date_create('1997-09-02 11:40:00'),
date_create('1997-09-02 12:00:00'),
date_create('1997-09-02 12:20:00'),
date_create('1997-09-02 12:40:00'),
date_create('1997-09-02 13:00:00'),
date_create('1997-09-02 13:20:00'),
date_create('1997-09-02 13:40:00'),
date_create('1997-09-02 14:00:00'),
date_create('1997-09-02 14:20:00'),
date_create('1997-09-02 14:40:00'),
date_create('1997-09-02 15:00:00'),
date_create('1997-09-02 15:20:00'),
date_create('1997-09-02 15:40:00'),
date_create('1997-09-02 16:00:00'),
date_create('1997-09-02 16:20:00'),
date_create('1997-09-02 16:40:00'),
date_create('1997-09-03 09:00:00'),
date_create('1997-09-03 09:20:00'),
date_create('1997-09-03 09:40:00'),
date_create('1997-09-03 10:00:00'),
date_create('1997-09-03 10:20:00'),
date_create('1997-09-03 10:40:00'),
date_create('1997-09-03 11:00:00'),
date_create('1997-09-03 11:20:00'),
date_create('1997-09-03 11:40:00'),
date_create('1997-09-03 12:00:00'),
date_create('1997-09-03 12:20:00'),
date_create('1997-09-03 12:40:00'),
date_create('1997-09-03 13:00:00'),
date_create('1997-09-03 13:20:00'),
date_create('1997-09-03 13:40:00'),
date_create('1997-09-03 14:00:00'),
date_create('1997-09-03 14:20:00'),
date_create('1997-09-03 14:40:00'),
date_create('1997-09-03 15:00:00'),
date_create('1997-09-03 15:20:00'),
date_create('1997-09-03 15:40:00'),
date_create('1997-09-03 16:00:00'),
date_create('1997-09-03 16:20:00'),
date_create('1997-09-03 16:40:00'))
'dtstart' => date_create('1997-09-02 09:00:00',new DateTimeZone('Australia/Sydney'))), array(
date_create('1997-09-02 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 09:20:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 09:40:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 10:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 10:20:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 10:40:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 11:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 11:20:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 11:40:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 12:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 12:20:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 12:40:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 13:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 13:20:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 13:40:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 14:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 14:20:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 14:40:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 15:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 15:20:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 15:40:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 16:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 16:20:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-02 16:40:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 09:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 09:20:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 09:40:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 10:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 10:20:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 10:40:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 11:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 11:20:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 11:40:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 12:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 12:20:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 12:40:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 13:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 13:20:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 13:40:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 14:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 14:20:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 14:40:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 15:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 15:20:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 15:40:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 16:00:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 16:20:00',new DateTimeZone('Australia/Sydney')),
date_create('1997-09-03 16:40:00',new DateTimeZone('Australia/Sydney')))
),
// An example where the days generated makes a difference because of wkst.
array(array('freq' => 'WEEKLY', 'interval' => 2, 'count' => 4,
Expand Down