ics-to-json
ics-to-json copied to clipboard
Improve usage example
The current usage example requires support for import and includes a fetch, both of which do not work in all environments where this js package might be used.
A simpler example might be:
const icsToJson = require('ics-to-json').default
console.log(icsToJson(`
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
BEGIN:VEVENT
SUMMARY:Access-A-Ride Pickup
DTSTART;TZID=America/New_York:20130802T103400
DTEND;TZID=America/New_York:20130802T110400
LOCATION:1000 Broadway Ave.\, Brooklyn
DESCRIPTION: Access-A-Ride trip to 900 Jay St.\, Brooklyn
STATUS:CONFIRMED
SEQUENCE:3
BEGIN:VALARM
TRIGGER:-PT10M
DESCRIPTION:Pickup Reminder
ACTION:DISPLAY
END:VALARM
END:VEVENT
BEGIN:VEVENT
SUMMARY:Access-A-Ride Pickup
DTSTART;TZID=America/New_York:20130802T200000
DTEND;TZID=America/New_York:20130802T203000
LOCATION:900 Jay St.\, Brooklyn
DESCRIPTION: Access-A-Ride trip to 1000 Broadway Ave.\, Brooklyn
STATUS:CONFIRMED
SEQUENCE:3
BEGIN:VALARM
TRIGGER:-PT10M
DESCRIPTION:Pickup Reminder
ACTION:DISPLAY
END:VALARM
END:VEVENT
END:VCALENDAR
`))
Result:
[ { summary: 'Access-A-Ride Pickup',
startDate: '20130802T103400',
endDate: '20130802T110400',
location: '1000 Broadway Ave., Brooklyn',
description: 'Access-A-Ride trip to 900 Jay St., Brooklyn' },
{ summary: 'Access-A-Ride Pickup',
startDate: '20130802T200000',
endDate: '20130802T203000',
location: '900 Jay St., Brooklyn',
description: 'Access-A-Ride trip to 1000 Broadway Ave., Brooklyn' } ]