All Projects → jekuer → add-to-calendar-button

jekuer / add-to-calendar-button

Licence: other
A convenient JavaScript snippet, which lets you create beautiful buttons, where people can add events to their calendars.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects
CSS
56736 projects

Projects that are alternatives of or similar to add-to-calendar-button

Python O365
A simple python library to interact with Microsoft Graph and Office 365 API
Stars: ✭ 742 (+6.46%)
Mutual labels:  microsoft, calendar, outlook
Daily Coding Problem
Series of the problem 💯 and solution ✅ asked by Daily Coding problem👨‍🎓 website.
Stars: ✭ 90 (-87.09%)
Mutual labels:  microsoft, apple
Ngx Auth Firebaseui
Angular Material UI component for firebase authentication
Stars: ✭ 518 (-25.68%)
Mutual labels:  microsoft, apple
Microsoft Todo Mac
🐜 Microsoft-ToDo macOS App. 微软Todo mac客户端.
Stars: ✭ 138 (-80.2%)
Mutual labels:  microsoft, apple
Ultratabsaver
The open source Tab Manager Extension for Safari.
Stars: ✭ 178 (-74.46%)
Mutual labels:  apple, free
tl-create
tl-create is a cross-platform command line tool to create a X.509 trust list from various trust stores. (Keywords: CABFORUM, eIDAS, WebPKI)
Stars: ✭ 32 (-95.41%)
Mutual labels:  microsoft, apple
Exchangelib
Python client for Microsoft Exchange Web Services (EWS)
Stars: ✭ 787 (+12.91%)
Mutual labels:  microsoft, outlook
dhtml2pdf
Simple, free and very easy to use PHP API that allows you to see, download or get the binary of the PDF generated from the HTML of an URL.
Stars: ✭ 27 (-96.13%)
Mutual labels:  simple, free
tensorflowjs-remove-background
Remove Background from the picture using WebAssembly & TensorFlow.js
Stars: ✭ 79 (-88.67%)
Mutual labels:  vanilla-js, vanillajs
FritzBoxTelefon-dingsbums
Das Fritz!Box Telefon-dingsbums ist ein Outlook-Addin, welches ein direktes Wählen der Kontakte aus Outlook ermöglicht. Zusätzlich bietet es nützliche Funktionen, wie einen Anrufmonitor oder eine Rückwärtssuche.
Stars: ✭ 16 (-97.7%)
Mutual labels:  microsoft, outlook
react-native-beautiful-timeline
Fully customizable, beautifully designed Timeline for React Native.
Stars: ✭ 111 (-84.07%)
Mutual labels:  apple, calendar
RaspberryPi-WeatherStation
7.5 ePaper Waveshare Outlook WeatherStation 墨水屏台历
Stars: ✭ 30 (-95.7%)
Mutual labels:  calendar, outlook
Flags
⛳ Simple, extensible, header-only C++17 argument parser released into the public domain.
Stars: ✭ 187 (-73.17%)
Mutual labels:  simple, free
Mfcmapi
MFCMAPI
Stars: ✭ 501 (-28.12%)
Mutual labels:  microsoft, outlook
Web Presentation
Jekyll theme template to create web presentation
Stars: ✭ 137 (-80.34%)
Mutual labels:  simple, free
Pg Calendar
📆 beautiful and eidetic date picker
Stars: ✭ 109 (-84.36%)
Mutual labels:  simple, calendar
mr-brown
Mr.Brown is a responsive Jekyll theme
Stars: ✭ 21 (-96.99%)
Mutual labels:  simple, free
Server Manager
This repository holds the IntISP Interface. It can be rebuilt to interface with any other hosting panel.
Stars: ✭ 31 (-95.55%)
Mutual labels:  simple, free
Freelook
Freelook, an Electron-based client for Microsoft Outlook.
Stars: ✭ 159 (-77.19%)
Mutual labels:  microsoft, outlook
WHMCS-Discord-Notifications
A hook to push a range of different WHMCS notifications instantly to a Discord channel.
Stars: ✭ 52 (-92.54%)
Mutual labels:  simple, free

Add-to-Calendar Button

Your next Add-to-Calendar Button

A convenient JavaScript snippet (VanillaJS, React, Angular, ...), which lets you create beautiful buttons, where people can add events to their calendars.

#1 Product of the Day on ProductHunt

Code Quality Build Status npm Installations jsDelivr npm Hits



This is for everybody, who wants to include a button at his/her website or app, which enables users to easily add a specific event to their calendars. It's main goal is to keep this process as easy as possible at maximum compatibility. Simply define your button configuration and everything else is automatically generated by the script. Supporting calendars at Apple, Google, Microsoft (365, Outlook, Teams), Yahoo, and generic iCal.

Supported Calendars

The script integrates easily with any usual HTML webpage (VanillaJS way) as well as popular JavaScript frameworks and libraries like Angular, React, Vue, Svelte, and more.

Supported Technology

In terms of system support, all modern browsers (Chrome, Edge, Firefox, Safari) on Windows, Mac, Android, and iOS as well as rather restricted environments like the Instagram in-app browser are supported.





▶️ Demo

See jekuer.github.io/add-to-calendar-button for a live demo.

And remember to star this repository in order to save it for later! 🤗



Features

  • Simple and convenient integration of multiple buttons, configurable directly within the HTML code.
  • Optimized and adjustable UX (for desktop and mobile).
  • Beautiful UI (the best combined from experts around the world).
  • Up-to-date integration of all popular calendars:
    • Google Calendar.
    • Yahoo Calender.
    • Microsoft 365, Outlook, and Teams.
    • Automatically generated iCal/ics files (for all other calendars, like Apple).
  • Timed and all-day events.
  • Recurring events (where supported by the calendar)
  • Translatable labels and dynamic dates.
  • Dynamic dates and timezone.
  • Auto-generated Schema.org rich (structured) data for better SEO.
  • Full support for mouse, touch, or keyboard input.
  • Well documented code, to easily understand the processes and build on top of it.

Demo Screenshot




📦 Installation / Setup

Option 1: simple (CDN)

You can use the jsDeliver CDN and load the respective ressources into your web project.

Put the css (use atcb-3d for an alternative style) into the <head>:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/add-to-calendar-button/assets/css/atcb.min.css">

... and the javascript into the <body> footer:

<script src="https://cdn.jsdelivr.net/npm/add-to-calendar-button" async defer></script>

Mind that this always pulls the latest version! You can pin a specific one by adding "@" + the version number after "button" - see jsDeliver.com for details. If you want to rather host it yourself, you could also download the source files or clone the repository (mind to take the original one at github.com/jekuer/add-to-calendar-button) and maintain/update it manually.


Option 2: npm

Import the package using the following npm command:

npm install add-to-calendar-button

Import the module into your project/component. For example with Angular/React:

import { atcb_action, atcb_init } from 'add-to-calendar-button';

Either use atcb_action with your own buttons/forms/etc, or run atcb_init after the DOM has been loaded. To determine the right moment to execute, ... - with Angular, you would use ngAfterViewInit() with atcb_init(); (mind that, depending on your app, other hooks might be better); - with React, you might want to include an event listener like document.addEventListener('DOMContentLoaded', atcb_init, false); or using hooks in a functional component like useEffect(() => atcb_init());

Include the css. For example with Angular or React, add @import 'add-to-calendar-button/assets/css/atcb.min' to some other css file - or include it in other more direct ways (like adding import 'add-to-calendar-button/assets/css/atcb.css'; to the respective component) (use atcb-3d for an alternative style).



🎛️ Configuration

A button can be easily created by placing a respective placeholder, wherever you want the button to appear. (The style="display:none;" theoretically is not necessary, but should be used for better compatibility.)

<div class="atcb" style="display:none;">(...)</div>

Within this placeholder, you can easily configure the button, by placing a respective JSON structure. Mind that with Angular, you might need to escape the { with {{ '{' }} and } with {{ '}' }}; with React it would be { '{' } and { '}' }.


Minimal structure (required)

Mind that for auto-generating rich snippets, a location would be mandatory as well.

<div class="atcb" style="display:none;">
  {
    "name":"Add the title of your event",
    "startDate":"2022-02-21",
    "endDate":"2022-03-24",
    "options":[
      "Google"
    ]
  }
</div>

Full structure

(More hidden options are described further below.)

<div class="atcb" style="display:none;">
  {
    "name":"Add the title of your event",
    "description":"A nice description does not hurt",
    "startDate":"2022-02-21",
    "endDate":"2022-03-24",
    "startTime":"10:13",
    "endTime":"17:57",
    "location":"Somewhere over the rainbow",
    "label":"Add to Calendar",
    "options":[
      "Apple",
      "Google",
      "iCal",
      "Microsoft365",
      "MicrosoftTeams",
      "Outlook.com",
      "Yahoo"
    ],
    "timeZone":"Europe/Berlin",
    "trigger":"click",
    "inline":true,
    "listStyle":"modal",
    "iCalFileName":"Reminder-Event"
  }
</div>

React examples

atcb_action

If you can't or don't want to use atcb_init, you can use the atcb_action import with your own buttons or other elements/components.

This may work better with React and other frontend frameworks, but it misses the Schema.org and button specific functionalities.

import React from 'react';
import { atcb_action } from 'add-to-calendar-button';

const MyComponent = () => {
  const [name, setName] = React.useState("Some event");
  const changeName = e => {
    setName(e.target.value);
  };
  return (
    <form onSubmit={e => {
      e.preventDefault();
      atcb_action({
        name,
        startDate: "2022-10-14",
        endDate: "2022-10-18",
        options: ['Apple', 'Google', 'iCal', 'Microsoft365', 'Outlook.com', 'Yahoo'],
        timeZone: "Europe/Berlin",
        iCalFileName: "Reminder-Event",
      });
    }}>
      <input value={name} onChange={changeName} />
      <input type="submit" value="save" />
    </form>
  );
}

atcb_init

Alternatively, you could use atcb_init with a useEffect hook:

import React from "react";
import { atcb_init } from "add-to-calendar-button";
import 'add-to-calendar-button/assets/css/atcb.css';

const MyComponent = () => {
  React.useEffect(atcb_init, []);
  return (
    <div className="atcb">
      { '{' }
        "name":"Add the title of your event",
        "description":"A nice description does not hurt",
        "startDate":"2022-02-21",
        "endDate":"2022-03-24",
        "startTime":"10:13",
        "endTime":"17:57",
        "location":"Somewhere over the rainbow",
        "label":"Add to Calendar",
        "options":[
          "Apple",
          "Google",
          "iCal",
          "Microsoft365",
          "Outlook.com",
          "Yahoo"
        ],
        "timeZone":"Europe/Berlin",
        "iCalFileName":"Reminder-Event"
      { '}' }
    </div>
  );
}



Important information and hidden features

  • The label is optional, but enables you to customize the button text. Default: "Add to Calendar".
  • Dates need to be formatted as YYYY-MM-DD (ISO-8601).
  • You can also use the word today as date. It will then dynamically use the current day at click.
  • Add +5 at the end of the date to dynamically add 5 days (or any other number). 2022-01-30+12 would generate the 11th of February 2022. This can be interesting, when combined with today.
  • Times need to be formatted as HH:MM.
  • Times are optional. If not set, the button generates all-day events.
  • 1 option is required. You can add as many as you want. The supported formats are listed above.
  • If you want to rename (or translate) a label, use the following schema at the options: optionName + Pipe + yourLabel. "Google|Google Kalender" would generate a Google Calendar option, but label it as "Google Kalender".
  • You can and should add a timeZone (TZ name). Find a list of them at Wikipedia.
  • Alternatively, you can set the timeZoneOffset, which will always override the timeZone. If neither of them is set, the date refers to UTC time.
  • The timeZone option is recommended since it considers things like summer/winter time, but might not work in very old browsers. timeZoneOffset works with older browsers, but is quite static.
  • Use "currentBrowser" as value for timeZone to dynamically use the time of the user's browser. Use this with caution, since it would mean that the date and time will differ per user, which should not be the usual case! (Requires all times to be set.)
  • Use "recurrence" to define recurring events. Use can use any valid RRULE to define the respective rule (click here for a generator). But mind that this will deactivate the Yahoo, Microsoft365, Teams, and Outlook options, since they do not support it at the moment (users could still use iCal in this case).
  • You can set the trigger to click. This makes the button open on click at desktop. Otherwise, the default would be to open on hover. On touch devices, this makes no difference.
  • If you want to define a specific name for any generated ics file (iCal), you can specify it via the iCalFileName option. The default would be "event-to-save-in-my-calendar".
  • ics files are generated on the fly. However, if you want to go more stable, you can also explicitly define a self-hosted file, setting its path with the icsFile option.
  • You can use the option "inline":true in order to make the button appear with inline-block instead of block style.
  • Use "background":false if you want to be the background overlay to be fully transparent.
  • The default style for the options list, using the regular button, would be a dropdown. You can set the option listStyle to "modal" in order to force the modal version (this would also force the click trigger).
  • Formatting a URL in the description like [url]https://....[/url] makes it clickable. [url]https://....|URL Text[/url] defines a linked textblock saying "URL Text" (not supported by Apple, iCal, and Yahoo; not supporting special characters).
  • If you require line breaks within the description, use \n or <br>.
  • If you set at least a name, startDate, and location, the script automatically generates schema.org rich data. Use a URL for the location and it will be labeled as online event.
  • There is almost no system defined text, which is presented to the user. For the tiny little rest, you can define a translation by using the language option. Supported options and therefore languages: en (default), de.
  • Each generated button and option has a speaking id to be used for any tracking methods. Scheme: "atcb-btn-IDENTIFIER" or "atcb-btn-IDENTIFIER-google" (for the Google option) respectively. The IDENTIFIER will be an automatic number, but can be overridden by providing the option "identifier":"xyz" (no special characters allowed; needs to be unique).
  • The default layout is more or less basic. Load the atcb-3d.min.css instead to have some more animations and depth.



🙌 Contributing

Anyone is welcome to contribute, but mind the guidelines:

IMPORTANT NOTE: Run npm install, npm format, and npm run build to auto-lint, create the minified js and css files, its sourcemap files as well as the npm_dist/ folder and content!


Changelog

Find all changes in the dedicated file at CHANGELOG.md.


💜 Kudos go to


📃 Copyright and License

Copyright (c) Jens Kuerschner.

Licensed under MIT license (with “Commons Clause” License Condition v1.0).




🔎 Why this repo exists

While building a personal wedding page, I was confronted with the task to include a button, where invited people could save the event to their calendars. I did not want to build this from scratch (first) and therefore started the usual web research. Unfortunately, all I found where some extremely outdated code snippets, which did not really fit all the modern systems and calendar tools. Beside that, there was only the solution by AddEvent.com - all over the place. I was looking at CodePen and all I found where thousands of pens, which basically only included the AddEvent tool.

The problems with AddEvent.com:

  • it holds tons of features, which I did not need. They make sense for companies, but not for most personal projects.
  • it limits the free tier to 50 event adds per month (consider the wedding case - this is way too less - they upgraded that in the meantime, but still).
  • it brings some data privacy issues, since you basically send your users to their not really data secured service. GDPR alert!
  • the UX/UI is not ideal (imho).

Bottom line: Paying for features, which I did not need - at additional privacy concerns - that made me create this solution (for you).


Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].