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

Method to check if a supplied date is inside a RRULE #64

Open
Sidhesh-naik-cci opened this issue Dec 27, 2023 · 1 comment
Open

Method to check if a supplied date is inside a RRULE #64

Sidhesh-naik-cci opened this issue Dec 27, 2023 · 1 comment
Labels
T: Feature Type: New Features

Comments

@Sidhesh-naik-cci
Copy link

Is there a way to check if a supplied date is inside an RRULE?

@JonasWanke
Copy link
Owner

Currently, this is only possible by iterating over the returned DateTimes and checking whether they contain that target value. The following code should do exactly that:

final isTargetContainedInRule = recurrenceRule.getAllInstances(
  start: start,
  after: target,
  includeAfter: true,
  before: target,
  includeBefore: true,
).isNotEmpty

This is not really efficient right now. If you want to query multiple dates, you can instead call getAllInstances(…) once for the whole range you're interested in and check the resulting list for your dates.

Also, with #66, iteration over recurrence rules without a count parameter can actually skip to the after value, which can speed this check up.

@JonasWanke JonasWanke added the T: Feature Type: New Features label Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: Feature Type: New Features
Projects
None yet
Development

No branches or pull requests

2 participants