diff --git a/lib/src/modals.dart b/lib/src/modals.dart index 2903f40e..8461f9eb 100644 --- a/lib/src/modals.dart +++ b/lib/src/modals.dart @@ -145,6 +145,10 @@ class RecurrenceSettings { final List weekdays; final List? excludeDates; + // For recurrence patterns other than weekly, where the event may not repeat + // on the start date. + // Excludes one occurrence since the event is already counted + // for the start date. int get _occurrences => (occurrences ?? 1) - 1; /// Calculates the end date for a monthly recurring event @@ -157,6 +161,7 @@ class RecurrenceSettings { /// Example: If the start date is 29-01-25 and the recurrence ends /// after 2 occurrences, /// the end date will be 29-03-25 because February does not have a 29th date. + /// Similarly for 30/31 date as well. DateTime get _endDateMonthly { var repetition = _occurrences; var nextDate = startDate; @@ -171,7 +176,6 @@ class RecurrenceSettings { // Adjust the date if the resulting month does not have the same day // as the start date // Example: DateTime(2024, 10 + 1, 31) gives 2024-12-01 - // TODO(Shubham): Review if in next consecutive month as well date does not found? if (nextDate.day != startDate.day) { nextDate = DateTime( nextDate.year, @@ -285,7 +289,7 @@ class RecurrenceSettings { } } - /// Calculates the end date for a recurring event based on the specified + /// Returns the end date for a recurring event based on the specified /// number of occurrences. /// /// This method requires at least one occurrence to process the recurrence.