mirror of
https://github.com/rlanvin/php-rrule.git
synced 2025-02-26 15:54:14 +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];
|
$tmp = $year.':'.$yearday.':'.$time[0].':'.$time[1].':'.$time[2];
|
||||||
if (! isset($filtered_set[$tmp])) {
|
if (! isset($filtered_set[$tmp])) {
|
||||||
$occurrence = \DateTime::createFromFormat(
|
$occurrence = \DateTime::createFromFormat(
|
||||||
'Y z',
|
'Y z H:i:s',
|
||||||
"$year $yearday",
|
"$year $yearday 00:00:00",
|
||||||
$this->dtstart->getTimezone()
|
$this->dtstart->getTimezone()
|
||||||
);
|
);
|
||||||
$occurrence->setTime($time[0], $time[1], $time[2]);
|
$occurrence->setTime($time[0], $time[1], $time[2]);
|
||||||
@ -1553,8 +1553,8 @@ class RRule implements RRuleInterface
|
|||||||
// normal loop, without BYSETPOS
|
// normal loop, without BYSETPOS
|
||||||
foreach ($dayset as $yearday) {
|
foreach ($dayset as $yearday) {
|
||||||
$occurrence = \DateTime::createFromFormat(
|
$occurrence = \DateTime::createFromFormat(
|
||||||
'Y z',
|
'Y z H:i:s',
|
||||||
"$year $yearday",
|
"$year $yearday 00:00:00",
|
||||||
$this->dtstart->getTimezone()
|
$this->dtstart->getTimezone()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1815,6 +1815,19 @@ class RRuleTest extends TestCase
|
|||||||
$this->assertEquals($count, $rrule->count());
|
$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
|
// GetOccurrences
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user