Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RDATE only adds dates without checking if dates are already present - expected behavior? #198

Open
scornelissen88 opened this issue Apr 14, 2022 · 0 comments

Comments

@scornelissen88
Copy link

Let's say I have this rule:

echo '<pre>';
$rule = new Rule('FREQ=WEEKLY;COUNT=10', new DateTime('next monday'));
$rule->setRDates([new DateInclusion((new DateTime())->setDate(2022,4,25), false)]);

foreach (
    (new ArrayTransformer)
        ->transform($rule)
    as $recurrence
) {
    var_dump($recurrence->getStart()->format('d-m-Y'));
}

This outputs the following:

string(10) "2022-04-18"
string(10) "2022-04-25"
string(10) "2022-05-02"
string(10) "2022-05-09"
string(10) "2022-05-16"
string(10) "2022-05-23"
string(10) "2022-05-30"
string(10) "2022-06-06"
string(10) "2022-06-13"
string(10) "2022-06-20"
string(10) "2022-04-25"

As you can see it's just adding the 25th a second time without checking if the 25th is already available in the recurrences. Not sure if this is expected behavior from the RFC or not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant