Last active
April 1, 2017 23:32
-
-
Save nathanmsmith/36d16cc05a4e6a24648ff4448656655f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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