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

Given an RRuleSet, how can we modify a single event in a recurrence #620

Open
gavin-traba opened this issue Mar 15, 2024 · 1 comment
Open

Comments

@gavin-traba
Copy link

gavin-traba commented Mar 15, 2024

Not quite an issue but a question around documentation. Didn't find anything when looking through existing issues. Want to also acknowledge maybe RRuleSet is not the right class to use, and potentially I should just use RRule.

Given an RRuleSet like

rruleSet.rrule(
  new RRule({
    freq: RRule.WEEKLY,
    byweekday: [RRule.MO,  RRule.TU, RRule.WE,  RRule.TH, RRule.FR],
    interval: 1,
    dtstart: datetime(2024, 3, 15, 9, 30),
  })
)

and i want to modify one of the events in this rule for example:

Fri, | 15 | Mar | 2024 | 9:30:00 | GMT 
Mon, | 18 | Mar | 2024 | 9:30:00 | GMT  // <-- this one i want to happen at 10:30:00 instead
Tue, | 19 | Mar | 2024 | 9:30:00 | GMT
Wed, | 20 | Mar | 2024 | 9:30:00 | GMT
Thu, | 21 | Mar | 2024 | 9:30:00 | GMT
Fri, | 22 | Mar | 2024 | 9:30:00 | GMT
Mon, | 25 | Mar | 2024 | 9:30:00 | GMT
Tue, | 26 | Mar | 2024 | 9:30:00 | GMT
Wed, | 27 | Mar | 2024 | 9:30:00 | GMT
Thu, | 28 | Mar | 2024 | 9:30:00 | GMT
Fri, | 29 | Mar | 2024 | 9:30:00 | GMT

Is this possible with the existing API?

EXDATE works great for canceling dates entirely, but modifying is a little more unclear to me 🤔

@gavin-traba gavin-traba changed the title Given an RRuleSet, how can we modify a single event in a recurrenc Given an RRuleSet, how can we modify a single event in a recurrence Mar 15, 2024
@HoekWax
Copy link

HoekWax commented Mar 15, 2024

Hello, you can exclude a date then add a new one like so

const ruleSet = new RRuleSet()
ruleSet.rrule(RRule.fromString(event.rrule))

// Exclude this date from the rrule
ruleSet.exdate(getDatetime(eventLog.eventAt))

// Add a new date to the rrule
ruleSet.rdate(getDatetime(patchData.eventAt))

You can try this if you want to remove an exdate at some point #541

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