Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions Ical.Net.Tests/GetOccurrenceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ public void SkippedOccurrenceOnWeeklyPattern()
var occurrences = RecurrenceUtil.GetOccurrences(
recurrable: vEvent,
periodStart: intervalStart,
periodEnd: intervalEnd,
includeReferenceDateInResults: false);
periodEnd: intervalEnd);
var occurrenceSet = new HashSet<CalDateTime>(occurrences.Select(o => o.Period.StartTime));

Assert.That(occurrenceSet, Has.Count.EqualTo(evaluationsCount));
Expand Down
55 changes: 42 additions & 13 deletions Ical.Net.Tests/RecurrenceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using Ical.Net.Serialization;
using Ical.Net.Serialization.DataTypes;
using NUnit.Framework;
using NUnit.Framework.Constraints;

namespace Ical.Net.Tests;

Expand Down Expand Up @@ -1232,8 +1233,8 @@
var rpe1 = new RecurrencePatternEvaluator(new RecurrencePattern("FREQ=YEARLY;WKST=MO;BYDAY=MO;BYWEEKNO=1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,47,49,51,53"));
var rpe2 = new RecurrencePatternEvaluator(new RecurrencePattern("FREQ=YEARLY;WKST=MO;BYDAY=MO;BYWEEKNO=53,51,49,47,45,43,41,39,37,35,33,31,29,27,25,23,21,19,17,15,13,11,9,7,5,3,1"));

var recurringPeriods1 = rpe1.Evaluate(new CalDateTime(start), start, end, false).ToList();
var recurringPeriods2 = rpe2.Evaluate(new CalDateTime(start), start, end, false).ToList();
var recurringPeriods1 = rpe1.Evaluate(new CalDateTime(start), start, end, default).ToList();

Check warning on line 1236 in Ical.Net.Tests/RecurrenceTests.cs

View workflow job for this annotation

GitHub Actions / coverage

Cannot convert null literal to non-nullable reference type.

Check warning on line 1236 in Ical.Net.Tests/RecurrenceTests.cs

View workflow job for this annotation

GitHub Actions / tests

Cannot convert null literal to non-nullable reference type.
var recurringPeriods2 = rpe2.Evaluate(new CalDateTime(start), start, end, default).ToList();

Check warning on line 1237 in Ical.Net.Tests/RecurrenceTests.cs

View workflow job for this annotation

GitHub Actions / coverage

Cannot convert null literal to non-nullable reference type.

Check warning on line 1237 in Ical.Net.Tests/RecurrenceTests.cs

View workflow job for this annotation

GitHub Actions / tests

Cannot convert null literal to non-nullable reference type.

Assert.That(recurringPeriods2, Has.Count.EqualTo(recurringPeriods1.Count));
}
Expand Down Expand Up @@ -2627,7 +2628,7 @@
var end = new CalDateTime(2019, 12, 31);
var rpe = new RecurrencePatternEvaluator(new RecurrencePattern("FREQ=WEEKLY;BYDAY=MO;BYWEEKNO=2"));

var recurringPeriods = rpe.Evaluate(start, start, end, false).ToList();
var recurringPeriods = rpe.Evaluate(start, start, end, default).ToList();

Check warning on line 2631 in Ical.Net.Tests/RecurrenceTests.cs

View workflow job for this annotation

GitHub Actions / coverage

Cannot convert null literal to non-nullable reference type.

Check warning on line 2631 in Ical.Net.Tests/RecurrenceTests.cs

View workflow job for this annotation

GitHub Actions / tests

Cannot convert null literal to non-nullable reference type.

Assert.That(recurringPeriods, Has.Count.EqualTo(1));
Assert.That(recurringPeriods.First().StartTime, Is.EqualTo(new CalDateTime(2019, 1, 7)));
Expand All @@ -2643,7 +2644,7 @@
var end = new CalDateTime(2020, 12, 31);
var rpe = new RecurrencePatternEvaluator(new RecurrencePattern("FREQ=WEEKLY;BYDAY=MO;BYMONTH=1"));

var recurringPeriods = rpe.Evaluate(start, start, end, false).OrderBy(x => x).ToList();
var recurringPeriods = rpe.Evaluate(start, start, end, default).OrderBy(x => x).ToList();

Check warning on line 2647 in Ical.Net.Tests/RecurrenceTests.cs

View workflow job for this annotation

GitHub Actions / coverage

Cannot convert null literal to non-nullable reference type.

Check warning on line 2647 in Ical.Net.Tests/RecurrenceTests.cs

View workflow job for this annotation

GitHub Actions / tests

Cannot convert null literal to non-nullable reference type.

Assert.That(recurringPeriods, Has.Count.EqualTo(4));
Assert.Multiple(() =>
Expand Down Expand Up @@ -2686,7 +2687,7 @@
var end = new CalDateTime(2020, 12, 31);
var rpe = new RecurrencePatternEvaluator(new RecurrencePattern("FREQ=MONTHLY;BYDAY=MO;BYMONTH=1"));

var recurringPeriods = rpe.Evaluate(start, start, end, false).OrderBy(x => x).ToList();
var recurringPeriods = rpe.Evaluate(start, start, end, default).OrderBy(x => x).ToList();

Check warning on line 2690 in Ical.Net.Tests/RecurrenceTests.cs

View workflow job for this annotation

GitHub Actions / coverage

Cannot convert null literal to non-nullable reference type.

Check warning on line 2690 in Ical.Net.Tests/RecurrenceTests.cs

View workflow job for this annotation

GitHub Actions / tests

Cannot convert null literal to non-nullable reference type.

Assert.That(recurringPeriods, Has.Count.EqualTo(4));
Assert.Multiple(() =>
Expand All @@ -2710,7 +2711,7 @@
var serializer = new RecurrencePatternSerializer();
var rp = (RecurrencePattern)serializer.Deserialize(sr)!;
var rpe = new RecurrencePatternEvaluator(rp);
var recurringPeriods = rpe.Evaluate(start, start, rp.Until, false).ToList();
var recurringPeriods = rpe.Evaluate(start, start, rp.Until, default).ToList();

Check warning on line 2714 in Ical.Net.Tests/RecurrenceTests.cs

View workflow job for this annotation

GitHub Actions / coverage

Cannot convert null literal to non-nullable reference type.

Check warning on line 2714 in Ical.Net.Tests/RecurrenceTests.cs

View workflow job for this annotation

GitHub Actions / tests

Cannot convert null literal to non-nullable reference type.

var period = recurringPeriods.ElementAt(recurringPeriods.Count - 1);

Expand Down Expand Up @@ -2932,8 +2933,7 @@
var occurrences = evaluator.Evaluate(
startDate,
fromDate,
toDate,
false)
toDate, default)
.OrderBy(o => o.StartTime)
.ToList();
Assert.That(occurrences, Has.Count.EqualTo(4));
Expand Down Expand Up @@ -2965,8 +2965,7 @@
var occurrences = evaluator.Evaluate(
startDate,
fromDate,
toDate,
false);
toDate, default);
Assert.That(occurrences.Count, Is.Not.EqualTo(0));
}

Expand Down Expand Up @@ -3073,8 +3072,7 @@
var periods = evaluator.Evaluate(
evtStart,
evtStart,
evtEnd,
false)
evtEnd, default)
.OrderBy(p => p.StartTime)
.ToList();
Assert.That(periods, Has.Count.EqualTo(10));
Expand Down Expand Up @@ -3908,7 +3906,7 @@
var cal = Calendar.Load(icalText);
var evt = cal.Events.First();
var ev = new EventEvaluator(evt);
var occurrences = ev.Evaluate(evt.DtStart, evt.DtStart.ToTimeZone(tzId), evt.DtStart.AddMinutes(61).ToTimeZone(tzId), false);
var occurrences = ev.Evaluate(evt.DtStart, evt.DtStart.ToTimeZone(tzId), evt.DtStart.AddMinutes(61).ToTimeZone(tzId), default);
var occurrencesStartTimes = occurrences.Select(x => x.StartTime).Take(2).ToList();

var expectedStartTimes = new[]
Expand All @@ -3919,4 +3917,35 @@

Assert.That(expectedStartTimes.SequenceEqual(occurrencesStartTimes), Is.True);
}

[Test]
[TestCase(null, false)]
[TestCase(0, true)]
[TestCase(1000, true)]
[TestCase(1440, false)]
public void TestMaxIncrementCount(int? limit, bool expectException)
{
var ical = """
BEGIN:VCALENDAR
BEGIN:VEVENT
DTSTART:20250305T000000
RRULE:FREQ=MINUTELY;BYHOUR=0;COUNT=100
END:VEVENT
END:VCALENDAR
""";

var cal = Calendar.Load(ical);

var options = new EvaluationOptions
{
MaxUnmatchedIncrementsLimit = limit,
};

IResolveConstraint constraint =
expectException
? Throws.Exception.TypeOf<EvaluationLimitExceededException>()
: Throws.Nothing;

Assert.That(() => cal.GetOccurrences(options: options).ToList(), constraint);
}
}
17 changes: 9 additions & 8 deletions Ical.Net/Calendar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System.Text;
using Ical.Net.CalendarComponents;
using Ical.Net.DataTypes;
using Ical.Net.Evaluation;
using Ical.Net.Proxies;
using Ical.Net.Serialization;
using Ical.Net.Utility;
Expand Down Expand Up @@ -190,16 +191,16 @@ public VTimeZone AddTimeZone(VTimeZone tz)
/// <param name="startTime">The beginning date/time of the range.</param>
/// <param name="endTime">The end date/time of the range.</param>
/// <returns>A list of occurrences that fall between the date/time arguments provided.</returns>
public virtual IEnumerable<Occurrence> GetOccurrences(CalDateTime startTime = null, CalDateTime endTime = null)
=> GetOccurrences<IRecurringComponent>(startTime, endTime);
public virtual IEnumerable<Occurrence> GetOccurrences(CalDateTime startTime = null, CalDateTime endTime = null, EvaluationOptions options = default)
=> GetOccurrences<IRecurringComponent>(startTime, endTime, options);

/// <inheritdoc cref="GetOccurrences(CalDateTime, CalDateTime)"/>
public virtual IEnumerable<Occurrence> GetOccurrences(DateTime? startTime, DateTime? endTime)
=> GetOccurrences<IRecurringComponent>(startTime?.AsCalDateTime(), endTime?.AsCalDateTime());
public virtual IEnumerable<Occurrence> GetOccurrences(DateTime? startTime, DateTime? endTime, EvaluationOptions options = default)
=> GetOccurrences<IRecurringComponent>(startTime?.AsCalDateTime(), endTime?.AsCalDateTime(), options);

/// <inheritdoc cref="GetOccurrences(CalDateTime, CalDateTime)"/>
public virtual IEnumerable<Occurrence> GetOccurrences<T>(DateTime? startTime, DateTime? endTime) where T : IRecurringComponent
=> GetOccurrences<T>(startTime?.AsCalDateTime(), endTime?.AsCalDateTime());
public virtual IEnumerable<Occurrence> GetOccurrences<T>(DateTime? startTime, DateTime? endTime, EvaluationOptions options = default) where T : IRecurringComponent
=> GetOccurrences<T>(startTime?.AsCalDateTime(), endTime?.AsCalDateTime(), options);

/// <summary>
/// Returns all occurrences of components of type T that start within the date range provided.
Expand All @@ -208,7 +209,7 @@ public virtual IEnumerable<Occurrence> GetOccurrences<T>(DateTime? startTime, Da
/// </summary>
/// <param name="startTime">The starting date range</param>
/// <param name="endTime">The ending date range</param>
public virtual IEnumerable<Occurrence> GetOccurrences<T>(CalDateTime startTime = null, CalDateTime endTime = null) where T : IRecurringComponent
public virtual IEnumerable<Occurrence> GetOccurrences<T>(CalDateTime startTime = null, CalDateTime endTime = null, EvaluationOptions options = default) where T : IRecurringComponent
{
// These are the UID/RECURRENCE-ID combinations that replace other occurrences.
var recurrenceIdsAndUids = this.Children.OfType<IRecurrable>()
Expand All @@ -219,7 +220,7 @@ public virtual IEnumerable<Occurrence> GetOccurrences<T>(CalDateTime startTime =

var occurrences = RecurringItems
.OfType<T>()
.Select(recurrable => recurrable.GetOccurrences(startTime, endTime))
.Select(recurrable => recurrable.GetOccurrences(startTime, endTime, options))

// Enumerate the list of occurrences (not the occurrences themselves) now to ensure
// the initialization code is run, including validation and error handling.
Expand Down
18 changes: 10 additions & 8 deletions Ical.Net/CalendarCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
using System.Text;
using Ical.Net.CalendarComponents;
using Ical.Net.DataTypes;
using Ical.Net.Evaluation;
using Ical.Net.Serialization;
using Ical.Net.Utility;
using static NodaTime.TimeZones.ZoneEqualityComparer;

namespace Ical.Net;

Expand Down Expand Up @@ -55,17 +57,17 @@
// being ordered to avoid full enumeration.
.OrderedMergeMany();

public IEnumerable<Occurrence> GetOccurrences(CalDateTime startTime = null, CalDateTime endTime = null)
=> GetOccurrences(iCal => iCal.GetOccurrences(startTime, endTime));
public IEnumerable<Occurrence> GetOccurrences(CalDateTime startTime = null, CalDateTime endTime = null, EvaluationOptions options = default)
=> GetOccurrences(iCal => iCal.GetOccurrences(startTime, endTime, options));

Check warning on line 61 in Ical.Net/CalendarCollection.cs

View check run for this annotation

Codecov / codecov/patch

Ical.Net/CalendarCollection.cs#L61

Added line #L61 was not covered by tests

public IEnumerable<Occurrence> GetOccurrences(DateTime? startTime, DateTime? endTime)
=> GetOccurrences(iCal => iCal.GetOccurrences(startTime, endTime));
public IEnumerable<Occurrence> GetOccurrences(DateTime? startTime, DateTime? endTime, EvaluationOptions options = default)
=> GetOccurrences(iCal => iCal.GetOccurrences(startTime, endTime, options));

public IEnumerable<Occurrence> GetOccurrences<T>(CalDateTime startTime = null, CalDateTime endTime = null) where T : IRecurringComponent
=> GetOccurrences(iCal => iCal.GetOccurrences<T>(startTime, endTime));
public IEnumerable<Occurrence> GetOccurrences<T>(CalDateTime startTime = null, CalDateTime endTime = null, EvaluationOptions options = default) where T : IRecurringComponent
=> GetOccurrences(iCal => iCal.GetOccurrences<T>(startTime, endTime, options));

Check warning on line 67 in Ical.Net/CalendarCollection.cs

View check run for this annotation

Codecov / codecov/patch

Ical.Net/CalendarCollection.cs#L67

Added line #L67 was not covered by tests

public IEnumerable<Occurrence> GetOccurrences<T>(DateTime? startTime, DateTime? endTime) where T : IRecurringComponent
=> GetOccurrences(iCal => iCal.GetOccurrences<T>(startTime, endTime));
public IEnumerable<Occurrence> GetOccurrences<T>(DateTime? startTime, DateTime? endTime, EvaluationOptions options = default) where T : IRecurringComponent
=> GetOccurrences(iCal => iCal.GetOccurrences<T>(startTime, endTime, options));

Check warning on line 70 in Ical.Net/CalendarCollection.cs

View check run for this annotation

Codecov / codecov/patch

Ical.Net/CalendarCollection.cs#L70

Added line #L70 was not covered by tests

private FreeBusy CombineFreeBusy(FreeBusy main, FreeBusy current)
{
Expand Down
9 changes: 5 additions & 4 deletions Ical.Net/CalendarComponents/Alarm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using System;
using System.Collections.Generic;
using Ical.Net.DataTypes;
using Ical.Net.Evaluation;

namespace Ical.Net.CalendarComponents;

Expand Down Expand Up @@ -73,7 +74,7 @@
/// Gets a list of alarm occurrences for the given recurring component, <paramref name="rc"/>
/// that occur between <paramref name="fromDate"/> and <paramref name="toDate"/>.
/// </summary>
public virtual IList<AlarmOccurrence> GetOccurrences(IRecurringComponent rc, CalDateTime? fromDate, CalDateTime? toDate)
public virtual IList<AlarmOccurrence> GetOccurrences(IRecurringComponent rc, CalDateTime? fromDate, CalDateTime? toDate, EvaluationOptions options)
{
if (Trigger == null)
{
Expand All @@ -94,7 +95,7 @@
}

Duration? duration = null;
foreach (var o in rc.GetOccurrences(fromDate, toDate))
foreach (var o in rc.GetOccurrences(fromDate, toDate, options))
{
var dt = o.Period.StartTime;
if (string.Equals(Trigger.Related, TriggerRelation.End, TriggerRelation.Comparison))
Expand Down Expand Up @@ -143,7 +144,7 @@
/// <param name="start">The earliest date/time to poll trigered alarms for.</param>
/// <param name="end"></param>
/// <returns>A list of <see cref="AlarmOccurrence"/> objects, each containing a triggered alarm.</returns>
public virtual IList<AlarmOccurrence> Poll(CalDateTime start, CalDateTime end)
public virtual IList<AlarmOccurrence> Poll(CalDateTime start, CalDateTime end, EvaluationOptions options = default)

Check warning on line 147 in Ical.Net/CalendarComponents/Alarm.cs

View workflow job for this annotation

GitHub Actions / coverage

Cannot convert null literal to non-nullable reference type.

Check warning on line 147 in Ical.Net/CalendarComponents/Alarm.cs

View workflow job for this annotation

GitHub Actions / coverage

Cannot convert null literal to non-nullable reference type.

Check warning on line 147 in Ical.Net/CalendarComponents/Alarm.cs

View workflow job for this annotation

GitHub Actions / coverage

Cannot convert null literal to non-nullable reference type.

Check warning on line 147 in Ical.Net/CalendarComponents/Alarm.cs

View workflow job for this annotation

GitHub Actions / coverage

Cannot convert null literal to non-nullable reference type.

Check warning on line 147 in Ical.Net/CalendarComponents/Alarm.cs

View workflow job for this annotation

GitHub Actions / tests

Cannot convert null literal to non-nullable reference type.

Check warning on line 147 in Ical.Net/CalendarComponents/Alarm.cs

View workflow job for this annotation

GitHub Actions / tests

Cannot convert null literal to non-nullable reference type.

Check warning on line 147 in Ical.Net/CalendarComponents/Alarm.cs

View workflow job for this annotation

GitHub Actions / tests

Cannot convert null literal to non-nullable reference type.

Check warning on line 147 in Ical.Net/CalendarComponents/Alarm.cs

View workflow job for this annotation

GitHub Actions / tests

Cannot convert null literal to non-nullable reference type.
{
var results = new List<AlarmOccurrence>();

Expand All @@ -154,7 +155,7 @@
return results;
}

results.AddRange(GetOccurrences(rc, start, end));
results.AddRange(GetOccurrences(rc, start, end, options));

Check warning on line 158 in Ical.Net/CalendarComponents/Alarm.cs

View check run for this annotation

Codecov / codecov/patch

Ical.Net/CalendarComponents/Alarm.cs#L158

Added line #L158 was not covered by tests
return results;
}

Expand Down
4 changes: 0 additions & 4 deletions Ical.Net/CalendarComponents/CalendarEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,6 @@ private void Initialize()
/// <returns>True if the event has not been cancelled, False otherwise.</returns>
public virtual bool IsActive => !string.Equals(Status, EventStatus.Cancelled, EventStatus.Comparison);

/// <inheritdoc/>
protected override bool EvaluationIncludesReferenceDate => true;

/// <inheritdoc/>
protected override void OnDeserializing(StreamingContext context)
{
Expand All @@ -280,7 +277,6 @@ protected bool Equals(CalendarEvent? other)
&& string.Equals(Status, other.Status, StringComparison.Ordinal)
&& IsActive == other.IsActive
&& string.Equals(Transparency, other.Transparency, TransparencyType.Comparison)
&& EvaluationIncludesReferenceDate == other.EvaluationIncludesReferenceDate
&& Attachments.SequenceEqual(other.Attachments)
&& CollectionHelpers.Equals(ExceptionRules, other.ExceptionRules)
&& CollectionHelpers.Equals(RecurrenceRules, other.RecurrenceRules);
Expand Down
7 changes: 4 additions & 3 deletions Ical.Net/CalendarComponents/FreeBusy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,21 @@
using System.Collections.Generic;
using System.Linq;
using Ical.Net.DataTypes;
using Ical.Net.Evaluation;
using Ical.Net.Utility;

namespace Ical.Net.CalendarComponents;

public class FreeBusy : UniqueComponent, IMergeable
{
public static FreeBusy Create(ICalendarObject obj, FreeBusy freeBusyRequest)
public static FreeBusy Create(ICalendarObject obj, FreeBusy freeBusyRequest, EvaluationOptions options = default)
{
if (!(obj is IGetOccurrencesTyped))
{
return null;
}
var getOccurrences = (IGetOccurrencesTyped) obj;
var occurrences = getOccurrences.GetOccurrences<CalendarEvent>(freeBusyRequest.Start, freeBusyRequest.End);
var occurrences = getOccurrences.GetOccurrences<CalendarEvent>(freeBusyRequest.Start, freeBusyRequest.End, options);
var contacts = new List<string>();
var isFilteredByAttendees = false;

Expand Down Expand Up @@ -196,4 +197,4 @@ public virtual void MergeWith(IMergeable obj)

Entries.AddRange(fb.Entries.Where(entry => !Entries.Contains(entry)));
}
}
}
4 changes: 1 addition & 3 deletions Ical.Net/CalendarComponents/Journal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ public Journal()
Name = JournalStatus.Name;
}

protected override bool EvaluationIncludesReferenceDate => true;

protected override void OnDeserializing(StreamingContext context)
{
base.OnDeserializing(context);
Expand All @@ -49,4 +47,4 @@ public override int GetHashCode()
hashCode = (hashCode * 397) ^ base.GetHashCode();
return hashCode;
}
}
}
10 changes: 4 additions & 6 deletions Ical.Net/CalendarComponents/RecurringComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ public class RecurringComponent : UniqueComponent, IRecurringComponent

public static IEnumerable<TRecurringComponent> SortByDate<TRecurringComponent>(IEnumerable<TRecurringComponent> list) => list.OrderBy(d => d);

protected virtual bool EvaluationIncludesReferenceDate => false;

public virtual IList<Attachment> Attachments
{
get => Properties.GetMany<Attachment>("ATTACH");
Expand Down Expand Up @@ -187,11 +185,11 @@ protected override void OnDeserializing(StreamingContext context)
Initialize();
}

public virtual IEnumerable<Occurrence> GetOccurrences(CalDateTime startTime = null, CalDateTime endTime = null)
=> RecurrenceUtil.GetOccurrences(this, startTime, endTime, EvaluationIncludesReferenceDate);
public virtual IEnumerable<Occurrence> GetOccurrences(CalDateTime startTime = null, CalDateTime endTime = null, EvaluationOptions options = default)
=> RecurrenceUtil.GetOccurrences(this, startTime, endTime, options);

public virtual IEnumerable<Occurrence> GetOccurrences(DateTime? startTime, DateTime? endTime)
=> RecurrenceUtil.GetOccurrences(this, startTime?.AsCalDateTime(), endTime?.AsCalDateTime(), EvaluationIncludesReferenceDate);
public virtual IEnumerable<Occurrence> GetOccurrences(DateTime? startTime, DateTime? endTime, EvaluationOptions options = default)
=> RecurrenceUtil.GetOccurrences(this, startTime?.AsCalDateTime(), endTime?.AsCalDateTime(), options);

public virtual IList<AlarmOccurrence> PollAlarms() => PollAlarms(null, null);

Expand Down
4 changes: 1 addition & 3 deletions Ical.Net/CalendarComponents/Todo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public virtual bool IsCompleted(CalDateTime currDt)
}

// Evaluate to the previous occurrence.
var periods = _mEvaluator.EvaluateToPreviousOccurrence(Completed, currDt);
var periods = _mEvaluator.EvaluateToPreviousOccurrence(Completed, currDt, options: default);

return periods.All(p => !p.StartTime.GreaterThan(Completed) || !currDt.GreaterThanOrEqual(p.StartTime));
}
Expand All @@ -169,8 +169,6 @@ public virtual bool IsActive(CalDateTime currDt)
/// <returns>True if the todo was cancelled, False otherwise.</returns>
public virtual bool IsCancelled => string.Equals(Status, TodoStatus.Cancelled, TodoStatus.Comparison);

protected override bool EvaluationIncludesReferenceDate => true;

protected override void OnDeserializing(StreamingContext context)
{
//ToDo: a necessary evil, for now
Expand Down
7 changes: 1 addition & 6 deletions Ical.Net/DataTypes/PeriodList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,8 @@ internal class PeriodList : EncodableDataType, IList<Period>
/// </summary>
protected IList<Period> Periods { get; } = new List<Period>();

// Also needed for the serialization factory
public PeriodList()
{
SetService(new PeriodListEvaluator(this));
}
{ }

/// <summary>
/// Creates a new instance of the <see cref="PeriodList"/> class from the <see cref="StringReader"/>.
Expand All @@ -52,8 +49,6 @@ private PeriodList(StringReader value)
{
CopyFrom(deserialized);
}

SetService(new PeriodListEvaluator(this));
}

/// <summary>
Expand Down
Loading