-
Notifications
You must be signed in to change notification settings - Fork 362
Description
When I first started using ice_cube to handle recurring dates, maybe a year+ ago, I wasn't sure how I could also handle recurrence information on the client side. I use rails in api mode to power an Angular application, so the recurring_select
gem mentioned in the readme wasn't a good choice.
After some hunting, I found rrulejs, which was pretty nice but, at that time, poorly maintained and buggy. It also didn't support time zones and breaks the ical spec in a few places, and I had to patch ice_cube to work with it. Obviously not ideal (though in the past month one community member has stepped up and fixed most all of these problems).
So I ended up making my own javascript (typescript) recurrence library that supports the ICAL spec and can communicate to/from ice_cube via ICAL strings. You can check it out over at rSchedule. It works very well with ice_cube.
rSchedule has full timezone support (depending on what javascript date library you're using with it), so I've paired it with the ice_cube timezone branch in #455, though that isn't necessary if someone doesn't care about timezone support.
Anyway, thanks so much for building and maintaining ice_cube for all this time!!! Having build rSchedule, I know how incredibly time consuming that must have been...
For anyone interested in using ice_cube with a (javascript / typescript) client side app, I'd recommend checking out rSchedule, as just sending down a schedule's ICAL string and iterating the dates on the client side is much less data intensive then sending individual dates to the client from the server.
rSchedule supports RRULE, EXRULE, RDATE, and EXDATEs.
Example rSchedule usage with ice_cube
Server side
ical_string = schedule.to_ical
client side
const schedule = Schedule.fromICal(ical_string, StandardDateAdapter)
for (const date of schedule.occurrences()) {
// do stuff
}
schedule.occursOn({date: new Date()}) // boolean
schedule.occursOn({weekday: 'TU'}) // boolean
schedule.occurrences({start: new Date(), take: 10}).toArray().map(date => date.toISOString())