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

Koekiebox
  • 5,793
  • 14
  • 53
  • 88
Nen
  • 171
  • 1
  • 1
  • 3

4 Answers4

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

Jeremy Thompson
  • 61,933
  • 36
  • 195
  • 321
k3b
  • 14,517
  • 7
  • 53
  • 85
  • 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 Sep 14 '15 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? – Jeremy Thompson Mar 10 '17 at 03: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 Nov 06 '19 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 – Jeremy Thompson Nov 07 '19 at 06:34
3

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.

Nathan Baulch
  • 20,233
  • 5
  • 52
  • 56
Tim Jones
  • 1,766
  • 12
  • 17
  • 1
    wow that is really ugly API design – Guy Dec 23 '10 at 09: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 Dec 23 '10 at 09:59
  • 5
    unfortionately this "ugly" recurrencepattern is part of the ical-fileformat – k3b Dec 23 '10 at 10:03
  • I was looking specifically for iCal recurrence, so this helped. – yzorg Dec 21 '11 at 01:59
3

Take a look at Itinerary. It does exactly this.

Disclosure: I'm the project maintainer.

spoulson
  • 21,335
  • 15
  • 77
  • 102
1

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

Claire Furney
  • 2,115
  • 3
  • 24
  • 36
Guy
  • 3,353
  • 24
  • 28