17

is there a free recurrence library that is available that we could use ?, we are looking for something like we supply the date time and the type of recurrence (daily, Monthly, Weekly and the interval(say for every 2 weeks or months or days) and we get a list of future dates ???

Thanks Nen

4 Answers 4

12

I am using dday-ical at sourceforge for recurrence calculations.

Beside loading and and saveing ical files it can interpretete calendar-recurrencerules a la

every 4th friday in every month but not on xmas

Have a look at mozilla-calendar (sunbird) or microsoft outlook to see how complex recurrence dates can be.

Update:

The project has moved to https://github.com/rianjs/ical.net and is available using Nuget: iCal.Net

4
  • For me the advantages of using this library is that it's RFC 5545 compliant. Which in turn is used by kendo Scheduler control J Though the format of input values might appear not very user friendly at the beginning.
    – alehro
    Commented Sep 14, 2015 at 21:20
  • 1
    I'd upvote if you gave a code example of how to call this library using string eg every 4th friday in every month and get that interpreted? Commented Mar 10, 2017 at 3:26
  • 1
    @JeremyThompson You're not going to get a natural language parser anywhere that I can find. iCal.Net will handle iCal rules, though: var serializer = new RecurrencePatternSerializer(); var pattern = (RecurrencePattern)serializer.Deserialize("FREQ=MONTHLY;INTERVAL=1;BYDAY=4FR");
    – Randolpho
    Commented Nov 6, 2019 at 15:08
  • @Randolpho I might not have been clear in my comment. I was saying the same thing as you (with future proofing allowed), and if the answer did have an example for the "4th Friday" then I would have upvoted. Cheers Commented Nov 7, 2019 at 6:34
4

Aspose.iCalendar, which is part of their Aspose.Network product, seems to have what you want:

//Ten team meetings, every Monday at 10am.
RecurrencePattern pattern = new RecurrencePattern(
  "DTSTART:20040301T100000\n" +
  "RRULE:FREQ=WEEKLY;COUNT=10;BYDAY=MO");
DateArray dates = pattern.GenerateOccurrences();

However, buying Aspose.Network just for that functionality is probably overkill.

4
  • 1
    wow that is really ugly API design
    – Guy
    Commented Dec 23, 2010 at 9:49
  • Not to mention that $599 is a little too much if you just want recurrence; it's a pity they don't release it as a standalone component. But still, it might give ideas for how (or how not) to design an API for recurrence.
    – Tim Jones
    Commented Dec 23, 2010 at 9:59
  • 5
    unfortionately this "ugly" recurrencepattern is part of the ical-fileformat
    – k3b
    Commented Dec 23, 2010 at 10:03
  • I was looking specifically for iCal recurrence, so this helped.
    – yzorg
    Commented Dec 21, 2011 at 1:59
3

Take a look at Itinerary. It does exactly this.

Disclosure: I'm the project maintainer.

2
  • no nuget package yet? :)
    – topwik
    Commented Apr 5, 2016 at 20:56
  • but does it understand ical format, like rrule stuff?
    – topwik
    Commented Apr 6, 2016 at 13:06
1

You might want to read this blog post by Jon Skeet on the subject, referring to the Noda Time library.

2
  • 2
    Here is an updated link to Jon Skeet's blog post: codeblog.jonskeet.uk/2010/12/01/…
    – David
    Commented Mar 12, 2015 at 21:30
  • 10
    <<Now just to make things clear, I’m not planning on talking about recurrent events – things like "the second Tuesday and the last Wednesday of every month">>. Guys, do you read the links you suggest?!
    – MatteoSp
    Commented Sep 21, 2016 at 15:44

Not the answer you're looking for? Browse other questions tagged or ask your own question.