Search code examples
c#.neticalendar

How to generate user friendly message based on icalendar format


Lets say we have recurrence rule like this one:

RRULE:FREQ=MONTHLY;BYDAY=-2FR;COUNT=7

My question is how to generate user friendly text from RRULE like this: every month on the 2nd last Friday for 7 times

Are there any .net c# libs, which allow to achieve that?


Solution

  • This one helped me. EWSoftware.PDI library contains Recurrence class with ToDescription method, which generates plain text description based on provided RRULE.

    var recurrence = new Recurrence("FREQ=MONTHLY;BYDAY=-2FR;COUNT=7")
    {
        StartDateTime = startDate
    };
    
    var description = recurrence.ToDescription();
    

    Output: Recur every month on the 2nd last Friday for 7 times