anushr
anushr

Reputation: 3400

Test if a date matches an iCalendar recurring event

I'm looking for an iCalendar rule matching algorithm that will allow me to validate if a particular date entered by a user falls on a date that is determined by an iCal recurring event rule.

For example:

Clearly Nov 1, 2014 does fall on a date in the ical event. How can I figure this out programatically? How can I get a list of dates determined by the recurrence rule, given a start date?

Any examples or libraries out there that do this?

I'm primarily looking for JS and PHP libraries/snippets, but any type of pseudocode should be fine.

Clarification: iCalendar refers to the RFC 5545 Internet Calendaring and Scheduling Core Object Specification

Upvotes: 1

Views: 1480

Answers (1)

Auberon Vacher
Auberon Vacher

Reputation: 4775

for PHP: phpicalendar (here), the catch is that the algorithm is not easily isolated from the rest of the code for JS there is a few attemps but I never checked if they really are compliant enough with rfc5545.

it all depends how much compliance you need: for instance adding timezone support will enable you to address the rare case of countries loosing one day (like Samoa island which skipped from Dec 29th to Dec 31st in 2011).

Upvotes: 1

Related Questions