Display the RFC 2445 of the recurrence with iCal.NET

32 Views Asked by At

I'm working with the iCal library in C#, and I would like to display the rule as a string.

I have implemented it with TypeScript:

const rule = new RRule({
      freq: RRule.DAILY,
      interval: 1,
      dtstart: startDate,
      until: endDate,
    });

console.log(rule.toString())

I would like to achieve the same thing with the iCal.NET library in C#.

i tried the following code

var rrule = new RecurrencePattern(frequency, interval) { Until = endDate };
rrule.ToString();

But it's seem that we don't have startDate, so i created CalendarEvent

var calendarEvent = new CalendarEvent {
       DtStart = new CalDateTime(startDate),
       Duration = TimeSpan.FromHours(23)
};
calendarEvent.DtEnd = new CalDateTime(endDate.Value); 
var recurrenceRule = new RecurrencePattern(frequency, interval) { Until = endDate }
calendarEvent.RecurrenceRules.Add(recurrenceRule);

But i'm still not able to display the rule as: DTSTART:20240325T000000Z RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20240331T235959Z ....

0

There are 0 best solutions below