@@ -3728,4 +3728,34 @@ public void ExecuteRecurrenceTestCase(RecurrenceTestCase testCase)
37283728
37293729 Assert . That ( startDates , Is . EqualTo ( testCase . Instances ) ) ;
37303730 }
3731+
3732+ [ Test ]
3733+ // Reproducer from https://github.com/ical-org/ical.net/issues/629
3734+ public void ShouldCreateARecurringYearlyEvent ( )
3735+ {
3736+ var springAdminEvent = new CalendarEvent
3737+ {
3738+ Start = new CalDateTime ( DateTime . Parse ( "2024-04-15" ) ) ,
3739+ End = new CalDateTime ( DateTime . Parse ( "2024-04-15" ) ) ,
3740+ RecurrenceRules = new List < RecurrencePattern > { new RecurrencePattern ( FrequencyType . Yearly , 1 ) } ,
3741+ } ;
3742+
3743+ var calendar = new Calendar ( ) ;
3744+ calendar . Events . Add ( springAdminEvent ) ;
3745+ var searchStart = DateTime . Parse ( "2024-04-15" ) ;
3746+ var searchEnd = DateTime . Parse ( "2050-5-31" ) ;
3747+ var occurrences = calendar . GetOccurrences ( searchStart , searchEnd ) ;
3748+ Assert . That ( occurrences . Count , Is . EqualTo ( 27 ) ) ;
3749+
3750+ springAdminEvent . Start = new CalDateTime ( DateTime . Parse ( "2024-04-16" ) ) ;
3751+ springAdminEvent . End = new CalDateTime ( DateTime . Parse ( "2024-04-16" ) ) ;
3752+ springAdminEvent . RecurrenceRules = new List < RecurrencePattern > { new RecurrencePattern ( FrequencyType . Yearly , 1 ) } ;
3753+
3754+ searchStart = DateTime . Parse ( "2024-04-16" ) ;
3755+ searchEnd = DateTime . Parse ( "2050-5-31" ) ;
3756+ occurrences = calendar . GetOccurrences ( searchStart , searchEnd ) ;
3757+
3758+ //occurences is 26 here, omitting 4/16/2024
3759+ Assert . That ( occurrences . Count , Is . EqualTo ( 27 ) ) ;
3760+ }
37313761}
0 commit comments