Skip to content

Instantly share code, notes, and snippets.

@nathanmsmith
Last active April 1, 2017 23:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathanmsmith/36d16cc05a4e6a24648ff4448656655f to your computer and use it in GitHub Desktop.
Save nathanmsmith/36d16cc05a4e6a24648ff4448656655f to your computer and use it in GitHub Desktop.
let events = [];
for (const calendar of calendars) {
console.log(calendar);
ical.fromURL(calendar, {}, (err, data) => {
for (var k in data) {
if (data.hasOwnProperty(k)) {
const event = data[k];
const eventStart = moment(event.start);
const now = moment();
const later = moment().add(1, 'days');
//console.log(eventStart.format('llll'));
if (eventStart.isBetween(now, later)) {
events.push(eventStart);
console.log('hi');
}
}
}
});
}
console.log(events);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment