-
Notifications
You must be signed in to change notification settings - Fork 247
fix: Evaluation of EXDATE when date-only while DTSTART is date-time
#830
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
Conversation
…`EvaluateRDate(referenceDate)`
Codecov ReportAll modified and coverable lines are covered by tests ✅ ❌ Your project status has failed because the head coverage (68%) is below the target coverage (80%). You can increase the head coverage or adjust the target coverage. @@ Coverage Diff @@
## main #830 +/- ##
===================================
Coverage 68% 68%
===================================
Files 106 106
Lines 4209 4216 +7
Branches 945 941 -4
===================================
+ Hits 2842 2849 +7
Misses 1039 1039
Partials 328 328
🚀 New features to boost your workflow:
|
|
@ical-org/maintainers It might be good to fix this issue, but in general, mixing DATE-only, DATE-TIME, floating and non-floating time, doesn't seem to be a good idea to me. Would be good to know, how much this is actually used in the wild. E.g. see this test case: The problem arises from the fact, that the order relation is unclear in such cases. The problem gets worse, if timezones would be involved. What do you think? |
|
I read the RFC definition of
I interpret this as: The If we match On the other hand, I can see the case to exclude all events by only providing the date since most calendars have daily as the smalles recurrence pattern. But even there we have to think about the moved events. |
|
Very good discussion! Having another look at the iCalendar specification section 3.8.5.1 we can see
I also agree with @minichma "but in general, mixing DATE-only, DATE-TIME, floating and non-floating time, doesn't seem to be a good idea". There are some supporting references from "the wild":
What could be our strategy - to be discussed: 1. Strict RFC Compliance by Default
2. Optional Leniency Mode
3. Parsing Logic
4. Developer Guidance
BTW: #829 shouldn't be considered a bug, should it? |
I think that the spec only says that the value type specified with the property must match. It doesn't seem to refer to DTSTART. |
Didn't interpret this way, but yes: good point. But still: Microsoft acknowledges deviations from RFC 5545 where Outlook accepts |
I think it should. The core of the problem there is that |
|
FWIW, as mentioned in #829 (comment), our use case is that some recurring events (with type DATE-TIME as DTSTART / DTEND) should not occur on holidays (i.e. EXDATE of type DATE). So, we feed the relevant list of holidays as EXDATES for those recurring events. To determine whether a specific occurrence is in such EXDATE date, I'd expect it to simply use the DATE part of the calculated start DATE-TIME of the occurrence. That might handle the time zone question. Thus, being able to use EXDATE of type DATE while the recurring event is DATE-TIME certainly simplifies things for us. |
|
Sorry, I commented only on parts of your comment so far. Thanks for the list of how 'the big ones' deal with this case. So I guess its clear then, that we'll have to support the case too.
I think we should implement one way of how we do it. If we add more modes, testing will become a nightmare. I also don't see a major benefit in having different modes here. Moreover, the RFC is not really clear in that respect. Regarding how Outlook deals with the case:
That the date is compared 'in the recurrence's time zone' prevents us from using |
|
|
Implemented it in a way now that each recurrence's date value in the recurrence's individual time zone is matched against the list of date-only EXDATEs. If the date portion matches, the recurrence is excluded. Tried to find out what outlook.com and Google Calendar are doing. This is what I found:
So those implementations seem to be conflicting in this respect and the now proposed is yet different. @ical-org/maintainers What do you think? |
| /// <param name="periodStart">The beginning date of the range to evaluate.</param> | ||
| protected IEnumerable<Period> EvaluateExDate(CalDateTime referenceDate, CalDateTime? periodStart) | ||
| /// <param name="periodKinds">The period kinds to be returned. Used as a filter.</param> | ||
| private IEnumerable<Period> EvaluateExDate(CalDateTime? periodStart, params PeriodKind[] periodKinds) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the signature and access modifier would mean a breaking change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Puh, right, theoretically yes. But for this to be an issue, somebody would have to inherit Recurring Evaluator and then call this method. I really wouldn't expect this to be the case. Would wait for potential complaints.
I'd say the updated implementation in this PR is fine and will get another entry to FAQ. |
EXDATE when date-only while DTSTART is date-time



Fix multiple issues related to the evaluation of
EXDATEs:EXDATEs of typeDATE-only were used together withDTSTARTof typeDATE-TIME, andGetOccurrences()was used with aperiodStarton the day of anEXDATE, then this EXDATE could be ignored.EXDATEs of typeDATEwere mixed with those of typeDATE-TIME, then the order could be confused, which could cause individualEXDATEs to be ignoredIts not clear from RFC 5545, whether EXDATEs and DTSTARTs of mixed, mismatching value types should be supported. Probably it shouldn't, because many things become unclear in such cases, especially when DTSTART has a time zone. Anyhow, because it seems to be used in the wild and has been supported in v4, we should probably continue to support it.
fixes #829, #832