Skip to content

iCalendar format builder and parser

License

Notifications You must be signed in to change notification settings

vsulak/iKalendar

 
 

Repository files navigation

iKalendar

NPM

IMPORTANT: This is an early stage release and project structure can change greatly!

Parser and builder for iCalendar data format

Table of Contents

Install

npm instal ikalendar

Usage

Builder

import { Builder, Calendar } from 'ikalendar'

const calendar: Calendar = {
    version: '2.0',
    prodId: 'Awesome project prodId',
    events: [
        {
            start: '20101231T083000Z',
            uid: '[email protected]'
        }
    ]
}

const builder = new Builder(calendar)
builder.build()

// Returns:
// 
// BEGIN:VCALENDAR
// VERSION:2.0
// PRODID:Awesome project prodId
// BEGIN:VEVENT
// DTSTAMP:20101231T083000Z
// UID:[email protected]
// END:VEVENT
// END:VCALENDAR

Parser

import { Parser } from 'ikalendar'

const str = `BEGIN:VCALENDAR
VERSION:2.0
PRODID:Awesome project prodId
BEGIN:VEVENT
DTSTAMP:20101231T083000Z
UID:[email protected]
END:VEVENT
END:VCALENDAR
`

const parser = new Parser(str)
parser.parse()

// Returns:
// 
// {
//     version: '2.0',
//     prodId: 'Awesome project prodId',
//     events: [
//         {
//             start: '20101231T083000Z',
//             uid: '[email protected]'
//         }
//     ]
// }

License

This project is licensed under the ISC License - see the LICENSE.md file for details

About

iCalendar format builder and parser

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 99.6%
  • JavaScript 0.4%