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
27 changes: 26 additions & 1 deletion Ical.Net.Tests/TodoTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// Licensed under the MIT license.
//

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -240,4 +239,30 @@ public void Todo_WithFutureStart_AndNoDuration_ShouldSucceed()
Assert.That(firstOccurrence.Period.StartTime, Is.Not.Null);
Assert.That(firstOccurrence.Period.Duration, Is.Null);
}

[Test, Category("Todo")]
public void Todo_RecurrenceWithNoEnd_IsCompletedUntilNextOccurrence()
{
var start = new CalDateTime(2026, 1, 15, 0, 0, 0, "UTC");

var todo = new Todo
{
Start = start,
RecurrenceRules = [new("FREQ=DAILY;BYDAY=TH")],
};

todo.Status = "COMPLETED";
todo.Completed = new CalDateTime(2026, 1, 16, 0, 0, 0, "UTC");

var results = Enumerable.Range(14, 10)
.Select(x => new CalDateTime(2026, 1, x, 0, 0, 0, "UTC"))
.Select(todo.IsCompleted)
.ToList();

// Jan 14-21: true (8 days) - TODO is considered completed
// Jan 22-23: false (2 days) - TODO is NOT completed
List<bool> expected = [true, true, true, true, true, true, true, true, false, false];

Assert.That(results, Is.EquivalentTo(expected));
}
}
2 changes: 1 addition & 1 deletion Ical.Net/Evaluation/TodoEvaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
DetermineStartingRecurrence(Todo.RecurrenceDates.GetAllPeriods(), ref beginningDate);
DetermineStartingRecurrence(Todo.RecurrenceDates.GetAllDates(), ref beginningDate);

foreach (var exrule in Todo.ExceptionRules)

Check warning on line 38 in Ical.Net/Evaluation/TodoEvaluator.cs

View workflow job for this annotation

GitHub Actions / tests

'RecurringComponent.ExceptionRules' is obsolete: 'EXRULE is marked as deprecated in RFC 5545 and will be removed in a future version'

Check warning on line 38 in Ical.Net/Evaluation/TodoEvaluator.cs

View workflow job for this annotation

GitHub Actions / coverage

'RecurringComponent.ExceptionRules' is obsolete: 'EXRULE is marked as deprecated in RFC 5545 and will be removed in a future version'

Check warning on line 38 in Ical.Net/Evaluation/TodoEvaluator.cs

View workflow job for this annotation

GitHub Actions / coverage

'RecurringComponent.ExceptionRules' is obsolete: 'EXRULE is marked as deprecated in RFC 5545 and will be removed in a future version'
{
DetermineStartingRecurrence(exrule, ref beginningDate);
}
Expand All @@ -48,7 +48,7 @@
}

return Evaluate(Todo.Start, beginningDate, options)
.Where(p => p.StartTime <= currDt);
.TakeWhile(p => p.StartTime <= currDt);
}

private static void DetermineStartingRecurrence(IEnumerable<Period> rdate, ref CalDateTime referenceDateTime)
Expand Down
Loading