mirror of
https://github.com/rlanvin/php-rrule.git
synced 2024-11-28 05:24:10 +01:00
Fix #120 Reset time to midnight to fix timezone offsets.
This commit is contained in:
parent
15646f89da
commit
fa13bf3f6b
@ -1510,8 +1510,8 @@ class RRule implements RRuleInterface
|
||||
$tmp = $year.':'.$yearday.':'.$time[0].':'.$time[1].':'.$time[2];
|
||||
if (! isset($filtered_set[$tmp])) {
|
||||
$occurrence = \DateTime::createFromFormat(
|
||||
'Y z',
|
||||
"$year $yearday",
|
||||
'Y z H:i:s',
|
||||
"$year $yearday 00:00:00",
|
||||
$this->dtstart->getTimezone()
|
||||
);
|
||||
$occurrence->setTime($time[0], $time[1], $time[2]);
|
||||
@ -1553,8 +1553,8 @@ class RRule implements RRuleInterface
|
||||
// normal loop, without BYSETPOS
|
||||
foreach ($dayset as $yearday) {
|
||||
$occurrence = \DateTime::createFromFormat(
|
||||
'Y z',
|
||||
"$year $yearday",
|
||||
'Y z H:i:s',
|
||||
"$year $yearday 00:00:00",
|
||||
$this->dtstart->getTimezone()
|
||||
);
|
||||
|
||||
|
@ -1815,6 +1815,19 @@ class RRuleTest extends TestCase
|
||||
$this->assertEquals($count, $rrule->count());
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests timezone transition in Daylight Savings Time switch.
|
||||
*/
|
||||
public function testDST()
|
||||
{
|
||||
$rrule = new RRule([
|
||||
'FREQ' => 'WEEKLY',
|
||||
'DTSTART' => new \DateTime('2022-10-30T01:00', new \DateTimeZone('America/Chicago')),
|
||||
'COUNT' => 2,
|
||||
]);
|
||||
$this->assertSame('2022-11-06T01:00:00-05:00 CDT 1667714400', $rrule[1]->format('c T U'));
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// GetOccurrences
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user