Skip to content

Commit

Permalink
Refactor advanceTheDate
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-davis committed May 17, 2024
1 parent 5230d22 commit a555817
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/Recur/RRuleIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,16 +292,16 @@ public function fastForward(\DateTimeInterface $dt): void
*/
protected function advanceTheDate(string $interval): void
{
$hourOfCurrentDate = (int) $this->currentDate->format('G');
$hourOfPreviousDate = (int) $this->currentDate->format('G');
$this->currentDate = $this->currentDate->modify($interval);
$hourOfNextDate = (int) $this->currentDate->format('G');
if (0 === $this->hourJump) {
// Remember if the clock time jumped forward on the next date.
// That happens if the next date is a day when summer time starts
// and the event time is in the non-existent hour of the day.
// For example, an event that normally starts at 02:30 will
// have to start at 03:30 on that day.
$this->hourJump = $hourOfNextDate - $hourOfCurrentDate;
$hourOfNextDate = (int) $this->currentDate->format('G');
$this->hourJump = $hourOfNextDate - $hourOfPreviousDate;
} else {
// The hour "jumped" for the previous date, to avoid the non-existent time.
// currentDate got set ahead by (usually) 1 hour on that day.
Expand Down

0 comments on commit a555817

Please sign in to comment.