📅 Calendar link generator for popular services

Overview

📅 Calendar Link

Status
Build Node CI Dependencies GitHub release (latest by date) Snyk Vulnerabilities for GitHub Repo
Health License Coverage Pull Request Labeler
Community NPM type definitions NPM All contributors

JavaScript library to generate an event link for Google Calendar, Yahoo! Calendar, Microsoft Outlook, etc.

NPM

Usage

// Usage with Node.js
const { google, outlook, office365, yahoo, ics } = require("calendar-link");

// Usage with TypeScript or ES6
import { google, outlook, office365, yahoo, ics } from "calendar-link";

// Set event as an object
const event = {
  title: "My birthday party",
  description: "Be there!",
  start: "2019-12-29 18:00:00 +0100",
  duration: [3, "hour"],
};

// Then fetch the link
google(event); // https://calendar.google.com/calendar/render...
outlook(event); // https://outlook.live.com/owa/...
office365(event); // https://outlook.office.com/owa/...
yahoo(event); // https://calendar.yahoo.com/?v=60&title=...
ics(event); // standard ICS file based on https://icalendar.org

Options

Property Description Allowed values
title (required) Event title String
start (required) Start time JS Date / ISO 8601 string / Unix Timestamp
end End time JS Date / ISO 8601 string / Unix Timestamp
duration Event duration Array with value (Number) and unit (String)
allDay All day event Boolean
description Information about the event String
location Event location in words String
busy Mark on calendar as busy? Boolean
guests Emails of other guests Array of emails (String)
url Calendar document URL String

Any one of the fields end, duration, or allDay is required.

The allowed units in duration are listed here: https://day.js.org/docs/en/durations/creating#list-of-all-available-units.

The url field defaults to document.URL if a global document object exists. For server-side rendering, you should supply the url manually.

Not all calendars support the guests and url fields.

License

MIT © Anand Chowdhary

Comments
  • Angular 11.2.x gives CommonJS or AMD dependencies warning with calendar-link

    Angular 11.2.x gives CommonJS or AMD dependencies warning with calendar-link

    When using calendar-link with angular 11.2.x, we get the following warning upon doing ng serve.

    Warning: D:\Git\Project\src\app\core\my.component.ts depends on 'calendar-link'. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

    CommonJS dependencies are being unadvised for Angular starting from versions 10.x.

    Info: Angular version: 11.2.9 Angular cli version: 11.2.8 calendar-link version: 2.0.16

    More information here: Configuring CommonJS dependencies

    opened by Heatmanofurioso 23
  • outlook live calendar showing different dates

    outlook live calendar showing different dates

    It seems like the startdt and enddt provided by us in query param is not getting triggered instead it is taking the current date.

    Below is the the event I tried to create.

    https://outlook.live.com/calendar/0/deeplink/compose?startdt=20200812T000000&enddt=20200813T120000&subject=Hello%20World&body=Hello%20World.

    bug help wanted good first issue 
    opened by govardhan5 16
  • An in-range update of @types/node is breaking the build 🚨

    An in-range update of @types/node is breaking the build 🚨

    The devDependency @types/node was updated from 11.10.4 to 11.10.5.

    🚨 View failing branch.

    This version is covered by your current version range and after updating it in your project the build failed.

    @types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

    Status Details
    • continuous-integration/travis-ci/push: The Travis CI build failed (Details).
    • Travis CI - Branch: The build failed.

    FAQ and help

    There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


    Your Greenkeeper Bot :palm_tree:

    greenkeeper 
    opened by greenkeeper[bot] 12
  • Outlook's link doesn't add the guests to the invite section.

    Outlook's link doesn't add the guests to the invite section.

    [email protected] Browser: Chrome@88

    Data passed eventData = { title: "topic", description: https://localhost:3000/zvhb0egh, start: startDate, duration, guests : [ "[email protected]" ] };

    Generated URL: https://outlook.live.com/calendar/0/deeplink/compose?body=https%3a%2f%2flocalhost%3a3000%2fzvhb0egh&enddt=2021-02-24T10%3a07%3a52+00%3a00&path=%2fcalendar%2faction%2fcompose&startdt=2021-02-24T10%3a07%3a08+00%3a00&subject=topic

    Notice, the invite attendees section is still empty. I would expect the email [email protected] to be there outlook

    wontfix 
    opened by mutebironald 9
  • Add bundler to allow usage via unpkg

    Add bundler to allow usage via unpkg

    index.modern.js may be used directly in ES modules

    <script type="module">
      import * as CalendarLink from 'https://unpkg.com/.../dist/index.modern.js';
    </script>
    

    index.umd.js may be used directly via external