From acc887644570604bc920800c870f925d126b3fba Mon Sep 17 00:00:00 2001 From: rlanvin Date: Fri, 6 Jan 2023 10:55:58 +0100 Subject: [PATCH] Add test that proves the issue --- tests/RRuleTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/RRuleTest.php b/tests/RRuleTest.php index c9a750f..49e523b 100755 --- a/tests/RRuleTest.php +++ b/tests/RRuleTest.php @@ -2660,6 +2660,20 @@ class RRuleTest extends TestCase $this->assertEquals($occurrences, $rrule->getOccurrences(), 'Mismatched timezones makes for strange results'); } + /** + * Tests timezone transition in Daylight Savings Time switch (bug #120) + * @see https://github.com/rlanvin/php-rrule/issues/120 + */ + 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')); + } + /////////////////////////////////////////////////////////////////////////////// // Other tests