4

At the moment, I've been making ajax calls to the PHP library iCalCreator to handle iCal events with recurrences. There's a function _recur2date in that, that calculates the next recurrence of an event, based on a given start date and an iCal RRULE (RFC 2445).

Is there a javascript library that will do the same: that is, given an RFC-2445 compliant recurrence rule, and a start date, will calculate the next recurrence?

1

I've been playing around a bit with iCal processing the last month or so (as a side side project) in both PHP & JS. I haven't yet used the js option I found very much; however so far it has seemed good enough to recommend.

rrule.js

It requires underscore.js and supports using nlp.js to do natural language processing of dates as well.

I don't believe there is a built in next however that is easy to do; I suspect you will want to do something like this:

function get_next(rulestring) {
    var rule = RRule.fromString(rulestring);
    return rule.all(function (date, i){return i < 1});
}
console.log(get_next("FREQ=WEEKLY;DTSTART=20120201T093000Z")); //any valid RFC2445 string.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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