8.0.1 • Published 11 months ago

datebook v8.0.1

Weekly downloads
3,982
License
MIT
Repository
github
Last release
11 months ago

Documentation

Read the docs →

Demo

Try the online calendar generator →

Quick Start

Installation

yarn add datebook

Examples

import { ICalendar } from 'datebook'

const config: CalendarOptions = {
  title: 'Happy Hour',
  location: 'The Bar, New York, NY',
  description: 'Let\'s blow off some steam with a tall cold one!',
  start: new Date('2022-07-08T19:00:00'),
  end: new Date('2022-07-08T23:30:00'),
  attendees: [
    {
      name: 'John Doe',
      email: 'john@doe.com',
      icsOptions: {
        rsvp: true
      }
    },
    {
      name: 'Jane Doe',
      email: 'jane@doe.com'
    }
  ],
  // an event that recurs every two weeks:
  recurrence: {
    frequency: 'WEEKLY',
    interval: 2
  }
}

const icalendar = new ICalendar(config)

iCalendar

With a reminder
icalendar
  .addAlarm({
    action: 'DISPLAY',
    description: 'Remember this event'
    trigger: {
      minutes: 10
    }
  })

This will add a reminder alarm that shows 10 minutes before the event.

With multiple events
const secondEvent = new ICalendar({
  title: 'Monthly Meeting with Boss Man',
  location: 'Conference Room 2A, Big Company, Brooklyn, NY',
  description: 'Meeting to discuss weekly things',
  start: new Date('2022-07-08T19:00:00'),
  recurrence: {
    frequency: 'MONTHLY'
  }
})

icalendar.addEvent(secondEvent)

This will add a second event to the same .ics file.

Adding other ICS properties
icalendar.addProperty('CATEGORIES', 'MEETINGS,MANAGEMENT')

This will add the CATEGORIES ICS property to the iCalendar instance.

Rendering ICS file content
const content = icalendar.render()

This will render ICS file content which can be downloaded onto the user's device for use in local calendar apps.

Google Calendar

const googleCalendar = new GoogleCalendar(config)

googleCalendar.render()

googleCalendar.render() will return a URL that the user can navigate to and pre-fill event details:

https://calendar.google.com/calendar/render?action=TEMPLATE&text=Happy%20Hour&details=Let's%20blow%20off%20some%20steam%20with%20a%20tall%20cold%20one!&location=The%20Bar%2C%20New%20York%2C%20NY&dates=20220708T190000%2F20220708T230000&recur=RRULE%3AFREQ%3DWEEKLY%3BINTERVAL%3D1
8.0.1

11 months ago

7.1.2

1 year ago

7.1.1

1 year ago

8.0.0

1 year ago

7.1.0

1 year ago

7.0.9

1 year ago

7.0.10

1 year ago

7.0.11

1 year ago

7.0.8

2 years ago

7.0.7

3 years ago

7.0.6

3 years ago

7.0.5

3 years ago

7.0.3

3 years ago

7.0.0

3 years ago

7.0.1

3 years ago

6.5.8

3 years ago

6.5.9

3 years ago

6.5.7

3 years ago

6.5.6

3 years ago

6.5.5

3 years ago

6.5.4

3 years ago

6.5.2

3 years ago

6.5.3

3 years ago

6.5.1

3 years ago

6.5.0

3 years ago

6.4.4

3 years ago

6.4.3

3 years ago

6.4.2

3 years ago

6.4.1

3 years ago

6.4.0

3 years ago

6.3.1

3 years ago

6.3.0

3 years ago

6.2.0

3 years ago

6.1.1

3 years ago

6.1.0

3 years ago

6.0.4

3 years ago

6.0.3

3 years ago

6.0.2

4 years ago

6.0.1

4 years ago

6.0.0

4 years ago

5.0.6

4 years ago

5.0.7

4 years ago

5.0.5

4 years ago

5.0.4

4 years ago

5.0.3

4 years ago

5.0.2

4 years ago

5.0.1

4 years ago

5.0.0

4 years ago

4.1.10

4 years ago

4.1.11

4 years ago

4.1.9

4 years ago

4.1.8

4 years ago

4.1.7

4 years ago

4.1.6

4 years ago

4.1.5

4 years ago

4.1.4

4 years ago

4.1.3

4 years ago

4.1.2

4 years ago

4.1.1

4 years ago

4.1.0

4 years ago

4.0.0

4 years ago

3.0.0

4 years ago

2.0.3

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

2.0.0

5 years ago