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

Cannot add exrule after querying rruleset #642

Open
jofmi opened this issue Oct 28, 2024 · 1 comment
Open

Cannot add exrule after querying rruleset #642

jofmi opened this issue Oct 28, 2024 · 1 comment

Comments

@jofmi
Copy link

jofmi commented Oct 28, 2024

If I apply exrule after querying the rruleset, the exrule will not be applied.

Here is an example:

const rruleSet = new RRuleSet();

// Add a rrule to rruleSet
rruleSet.rrule(
  new RRule({
    freq: RRule.MONTHLY,
    count: 5,
    dtstart: datetime(2012, 2, 1, 10, 30),
  }),
);

// Querying the rruleset before applying the exrule
console.log("Before", rruleSet.all());

// Add a exclusion rrule to rruleSet
rruleSet.exrule(
  new RRule({
    freq: RRule.MONTHLY,
    count: 2,
    dtstart: datetime(2012, 3, 1, 10, 30),
  }),
);

// If the ruleset is queried above, this will show 5 dates (exrule not applied)
// If the ruleset is NOT queried above, this will show 3 dates (exrule applied)
console.log("After", rruleSet.all());
@milande
Copy link

milande commented Nov 6, 2024

Affirmative. I ran into the same issue (even using the expample for exdate/rule from the README), only that I dind't understand that this due to the prior querring (so thx @jofmi, this was causing me some headage).

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

2 participants