Skip to content

Conversation

@minichma
Copy link
Collaborator

@minichma minichma commented Jul 9, 2025

See #825: According to existing code, GetOccurrences(periodStart) seems to be intended to return not only those recurrences that start at or after periodStart, but also those still active at that date-time. There's has been some discussion in #825 about whether to follow the original intention or rather just return those that start at or after periodStart.

This PR introduces a new evaluation option that allows to control the intended behavior. By default only those are returned that start at or after periodStart. By setting the new option EvaluationOptions.IncludeStillActiveOccurrences, also those are returned that started in the past but are still active at the given point in time.

Fixes #825

@minichma
Copy link
Collaborator Author

minichma commented Jul 9, 2025

@ical-org/maintainers Not sure it is the best idea to make the behavior configurable, as it introduces additional complexities, requires additional testing, etc. Please let me know what you think.

If someone would find the time, the PR would also deserve additional tests related to occurrences that should be returned and cross a DST change before periodStart. Not sure this case is handled correctly, probably not (anyhow, its better than today).

@minichma minichma force-pushed the work/minichma/bugfix/period_start branch from 75fdf91 to 2706999 Compare July 9, 2025 07:21
@minichma
Copy link
Collaborator Author

minichma commented Jul 9, 2025

@ical-org/maintainers formally the changes are breaking, at least due to classes becoming abstract. However, effectively those are not intended for being constructed/inherited by user code, so I'd consider this acceptable.

@axunonb
Copy link
Collaborator

axunonb commented Jul 12, 2025

Thanks! Few first comments:

  1. Looks like a good solution.
  2. Should EvaluationOptions.IncludeStillActiveOccurrences == true be the default behavior (also mentioned in GetOccurrences() with periodStart skips first occurrences if VEVENT has duration #825)? Then we wouldn't even need the new option, because the caller could easily identify ongoing occurrences.
  3. Naming: EvaluationOptions.IncludeOngoingOccurrences instead of EvaluationOptions.IncludeStillActiveOccurrences?
  4. XmlDoc for IGetOccurrences.GetOccurrences should reflect the behavior regarding ongoing occurrences.
  5. Not part of the PR: Update the Wiki

[Edit]

not intended for being constructed/inherited by user code,

Agree, should we then consequently disallow construction inheritance by user code?

@codecov
Copy link

codecov bot commented Jul 12, 2025

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

@minichma minichma force-pushed the work/minichma/bugfix/period_start branch from 2706999 to 69dcbc4 Compare July 15, 2025 07:09
@minichma
Copy link
Collaborator Author

Then we wouldn't even need the new option, because the caller could easily identify ongoing occurrences.

Agree, so I removed the last commit. Introduced the configuration because I don't like the behavior of filtering by the end time too much because the other way is simpler and easier to understand. Anyhow, the configuration adds even more complexity.

@minichma minichma force-pushed the work/minichma/bugfix/period_start branch from 69dcbc4 to 29d19e4 Compare July 15, 2025 07:13
@sonarqubecloud
Copy link

Copy link
Collaborator

@axunonb axunonb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks!

@minichma minichma merged commit fa100df into main Jul 15, 2025
9 checks passed
@minichma minichma deleted the work/minichma/bugfix/period_start branch July 15, 2025 13:19
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

Successfully merging this pull request may close these issues.

GetOccurrences() with periodStart skips first occurrences if VEVENT has duration

3 participants