tplaner / When

PHP Date Recursion library
https://github.com/tplaner/When
MIT License
513 stars 96 forks source link

FREQ=MONTHLY;UNTIL not working #79

Closed truecastdesign closed 3 years ago

truecastdesign commented 3 years ago

With a starting date of 2020-11-24T10:00:00-08:00

and

FREQ=MONTHLY;UNTIL=20210129T075959Z

I get these 3 dates. Not correct. It should output 2020-11-24, 2020-12-24, and 2021-01-24

[1] => stdClass Object ( [description] => This is the desc for the repeating event. [location] => [status] => confirmed [summary] => Repeating Event Tuesday [start] => 2021-01-24 10:00:00 [end] => 2021-01-24 10:30:00 )

[2] => stdClass Object
    (
        [description] => This is the desc for the repeating event.
        [location] => 
        [status] => confirmed
        [summary] => Repeating Event Tuesday
        [start] => 2021-01-24 10:00:00
        [end] => 2021-01-24 10:30:00
    )

[3] => stdClass Object
    (
        [description] => This is the desc for the repeating event.
        [location] => 
        [status] => confirmed
        [summary] => Repeating Event Tuesday
        [start] => 2021-01-24 10:00:00
        [end] => 2021-01-24 10:30:00
    )
boryn commented 3 years ago

Hi @truecastdesign, I have just tried version 3.1 with this code:

$r = new When();
$r->startDate(new \DateTime("2020-11-24T10:00:00-08:00"))
  ->rrule("FREQ=MONTHLY;UNTIL=20210129T075959Z")
  ->generateOccurrences();

return $r->occurrences;

and this produced the expected 2020-11-24, 2020-12-24, 2021-01-24.