0

I'm looking for a library in PHP (or better yet in ruby) to handle an events calendar. I've looked a dozens of them and every one breaks down when it comes to recurring events. Many require and end date and most create every recurring event as a entry in a database or something.

Every suggestion I get is to use the Google calendar which does do exactly what I want but I'm sure they won't let me build a service on top of there service.

gbennett
  • 120
  • 1
  • 7

4 Answers4

1

Sounds like you may not want to roll your own, but what about just setting up a cron job to check every x minutes if there are any events that have to be sent out?

John
  • 15,990
  • 10
  • 70
  • 110
1

Haven't used Runt myself, but it looks like it might do what you want.

According to their homepage:

Runt is an implementation of select temporal patterns by Martin Fowler in the super-fantastic Ruby language. Runt provides:

  • ability to define recurring events using simple, set-like expressions
  • an interfaced-based API for creating schedules for arbitrary events/objects
  • precisioned date types using Time Points
  • date Ranges
  • everlasting peace and/or eternal life
user119282
  • 337
  • 4
  • 12
1

RiCal's recurrence rules would work for this. They do the math, the implementation would be up to you.

require 'rubygems'
require 'ri_cal'
rule = RiCal::PropertyValue::RecurrenceRule::RecurringMonthDay.new(15)
p rule.include?(Date.new(2025, 7, 15)) # true
Ben
  • 6,857
  • 26
  • 23
0

One good thing to know about recurring events is that our calendar cycles every 28 years. i.e. today is thursday 3 december 2010, so I know that in excaclty 28 years(10226 days) we will be thursday 3 december 2038. With this knowledge you can build an occurencies table on a limited period of time and just "move" it to your targeted time range...

mlarcher
  • 447
  • 1
  • 7
  • 16