Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any node ical reader packages which work with rrule? #289

Closed
ghost opened this issue Oct 10, 2018 · 3 comments
Closed

Any node ical reader packages which work with rrule? #289

ghost opened this issue Oct 10, 2018 · 3 comments

Comments

@ghost
Copy link

ghost commented Oct 10, 2018

For this demo calendar: the output looks like this on a calendar reader:

screenclip 215

But from various ical readers like ical.js, and its various forks, all I get is the first event, and nothing if the first events of a series starts in the past.
ical.js appears unmaintained, although it DOES use this rrule library, it appears locked to v2.4.1

On 2018-10-09, Event repeating monthly on 2nd tuesday at 10am
On 2018-10-10, Event repeating weekly on a Wednesday at 11am
On 2018-10-11, Single event on 11th October

Code is as below - a few extras as I'm not interested in dates in the past, and it's nice to have things in upcoming date order, rather than random

const ical = require('ical');
var dateNow = new Date();

const url = "https://calendar.google.com/calendar/ical/ssjqjrg27h9mqqctfnr5kscmrk%40group.calendar.google.com/public/basic.ics";

  ical.fromURL(url, {}, function (err, data) {
    var ttsorted = [];
    for (const k in data) {
      const ev = data[k];
      const eventStart = new Date(ev.start);
      if (data.hasOwnProperty(k)) {
      if (eventStart.getTime() >= dateNow.getTime()) {
          const tts = `On ${ev.start.toISOString().slice(0,10)}, ${ev.summary} `;
          ttsorted.push(tts);
        }
     }
    }
    ttsorted.sort();
    for (const events of ttsorted) {
      console.log(events);
    }
  });
@davidgoli
Copy link
Collaborator

Hi, this library can help with generating a series of Dates from an RRULE, but does not offer eg. other "extended" calendar scheduling functionality (eg contact info, location, etc.). What functionality specifically are you looking for?

@ghost
Copy link
Author

ghost commented Oct 29, 2018

Thank you - well, just as per the original post really, I need start time, description, location for recurring events. From what you have said, if it does not include location etc then this might not be of use.

I read that https://github.com/peterbraden/ical.js/ uses rrule, but it does not handle any repeating events.

@davidgoli
Copy link
Collaborator

This library covers a rather specialized subset of the ical spec, but could be used as a part of a full implementation. Start time is fine, but description and location you'll have to manage outside of this library. I recommend using a parser like https://github.com/mozilla-comm/ical.js/ to parse the data, and rrule can help out with generating recurrences from any RRULE string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant