Add Events To Apple/Google/Yahoo/MicroSoft Calendars – atcb.js

Category: Date & Time , Javascript , Recommended | October 3, 2022
Author:jekuer
Views Total:3 views
Official Page:Go to website
Last Update:October 3, 2022
License:MIT

Preview:

Add Events To Apple/Google/Yahoo/MicroSoft Calendars – atcb.js

Description:

Add-to-Calendar Button is a JavaScript library that lets you add custom events to popular calendars (like Google Calendar, Yahoo Calendar, Outlook, Microsoft 365) and automatically generates iCal/ics files for other calendar services like Apple.

How to use it:

1. Add the Add-to-Calendar Button’s Stylesheet and JavaScript to the page.

<link rel="stylesheet" href="css/atcb.min.css" />
<script src="js/atcb.min.js"></script>

2. Insert your event data (JSON) into a hidden DIV container with the CSS class of atcb. That’s it.

<div class="atcb" style="display:none;">
  {
    "name":"Event Title",
    "startDate":"2022-02-24",
    "endDate":"2022-02-28",
    "options":[
      // add/remove calendars here
      "Apple",
      "Google",
      "iCal",
      "Microsoft365",
      "Outlook.com",
      "Yahoo"
    ],
  }
</div>

3. You can also define your event data in JSON-LD format.

<div class="atcb">
  <script type="application/ld+json">
    {
      "event": {
        "@context":"https://schema.org",
        "@type":"Event",
        "name":"Event Title",
        "description":"Event Description",
        "startDate":"2022-02-24T10:24",
        "endDate":"2022-02-28T18:56",
        "location":"Your Location"
      },
      "label":"Add to Calendar",
      "options":[
        "Apple",
        "Google",
        "iCal",
        "Microsoft365",
        "Outlook.com",
        "Yahoo"
      ],
    }
  </script>
</div>

4. Trigger the Add-to-Calendar menu on click instead.

<div class="atcb" style="display:none;">
  {
    "name":"Event Title",
    "startDate":"2022-02-24",
    "endDate":"2022-02-28",
    "options":[
      // add/remove calendars here
      "Apple",
      "Google",
      "iCal",
      "Microsoft365",
      "Outlook.com",
      "Yahoo"
    ],
    "trigger":"click",
  }
</div>

5. Add more detailed information to your event.

<div class="atcb" style="display:none;">
  {
    "name":"Event Title",
    "startDate":"2022-02-24",
    "endDate":"2022-02-28",
    "options":[
      // add/remove calendars here
      "Apple",
      "Google",
      "iCal",
      "Microsoft365",
      "Outlook.com",
      "Yahoo"
    ],
    "startTime":"10:24",
    "endTime":"18:56",
    "location":"Your Location",
    "label":"Text Displayed In The Button",
  }
</div>

6. The library also works with timezone:

<div class="atcb" style="display:none;">
  {
    "name":"Event Title",
    "startDate":"2022-02-24",
    "endDate":"2022-02-28",
    "options":[
      // add/remove calendars here
      "Apple",
      "Google",
      "iCal",
      "Microsoft365",
      "Outlook.com",
      "Yahoo"
    ],
    "timeZone":"Europe/Berlin",
    "timeZoneOffset":"+01:00",
  }
</div>

7. Customize the iCal/ics file name.

<div class="atcb" style="display:none;">
  {
    "name":"Event Title",
    "startDate":"2022-02-24",
    "endDate":"2022-02-28",
    "options":[
      // add/remove calendars here
      "Apple",
      "Google",
      "iCal",
      "Microsoft365",
      "Outlook.com",
      "Yahoo"
    ],
    "iCalFileName":"MY-Event"
  }
</div>

Changelog:

v1.17.0 (10/03/2022)

  • Fixing critical and not so critical bugs
  • Updating the license from MIT with “Commons Clause” to Apache-2.0

v1.16.0 (10/01/2022)

  • CSP fix
  • custom sequence, UID, and status support
  • bundle size optimization

v1.15.5 (09/17/2022)

  • Fixing an issue where a missing description would make the schema.org invalid.

v1.15.4 (09/17/2022)

  • Fixing multiple edge case issues
  • Fixing broken custom option labels
  • New optional flat style
  • Forcing Apple instead of iCal option on iOS

v1.15.3 (09/14/2022)

  • Google calendar GMT time zone fix
  • dependency updates
  • better build process

v1.15.2 (09/13/2022)

  • Bundle size optimization
  • Style updates

v1.15.1 (09/08/2022)

  • Catching misspelled JSON input errors
  • Fixing small rich data issue with recurring events

v1.15.0 (09/07/2022)

  • more stable time zone management via our own TimeZones iCal Library
  • more languages
  • easier recurrence
  • better schema.org support (incl. images)
  • organizer information

v1.14.6 (08/26/2022)

  • Minor fixes optimizing iCal distribution and tests.

v1.14.5 (08/24/2022)

  • Dependency updates
  • Supporting more languages (incl. arabic RTL)

v1.14.4 (08/17/2022)

  • Bugfixes
  • Style optimizations

v1.14.3 (08/10/2022)

  • Fixing a bug, where checking for mobile usage with react implementation failed

v1.14.2 (08/10/2022)

  • Fixing a bug, where the dropdown gets misplaced in some edge cases

v1.14.0/1 (08/09/2022)

  • better keyboard navigation
  • dynamic dropdown, automatically adjusting to the screen
  • new option to adjust size
  • Microsoft mobile bug (temporary) workaround
  • fixes and code refactoring

v1.13.2 (07/29/2022)

  • Bugfix

v1.13.0 (07/28/2022)

  • Introducing smart adaptive dark mode
  • Bug fixes
  • Some code refactoring (preparing future functionalities)

v1.12.0 (07/27/2022)

  • style updates
  • better input sanitization
  • webView edge case support
  • text block overwrite option

v1.11.4 (07/21/2022)

  • support HTML in ics files

v1.11.3 (07/21/2022)

  • endDate no longer required
  • multiple bug fixes

v1.11.2 (07/19/2022)

  • css bug fixes

v1.11.1 (07/18/2022)

  • Bugfixes
  • small optimizations

v1.11.0 (07/16/2022)

  • A billion bug fixes for better cross browser, OS, and device support.
  • Solution for Instagram in-app browser not downloading ics files.
  • Option to make the background transparent.
  • Option to set language for system text.
  • Recurring optimization (still missing full iCal timezone support).
  • Text option for URLs.
  • Catch for 1-option buttons, where we hide the dropdown.
  • Optimization of keyboard input.
  • General performance optimization.
  • New linting rules.
  • Better element id handling for more stable tracking support.
  • Option to explicitly provide an ics file for more stable support.
  • Re-rendering of dropdown on screen resize instead of closing it.
  • [Breaking] Reset the style to the initial plain on. 3D option still available as backup.

v1.10.1 (07/06/2022)

  • Minor bugfix

v1.10.0 (07/05/2022)

  • [Breaking!] Dropped the schema.org input
  • Instead, now auto-generating schema.org for every button
  • Optimized Readme and especially React examples

v1.9.1 (07/01/2022)

  • Bug fixes (e.g. hyperlinks being cut off) and security patches (incl. linter)

v1.9.0 (06/29/2022)

  • A lot of bug fixes and improvements.

v1.8.10 (06/15/2022)

  • Added a script to easily bump the version number and build the project all in one.

v1.8.9 (06/10/2022)

  • Buttons now have type=”button”

v1.8.8 (06/09/2022)

  • CSS fixes for better performance and iOS support.

v1.8.7 (06/08/2022)

  • Security patch for grunt dependency

v1.8.6 (05/06/2022)

  • Minor CSS animation fix

v1.8.5 (05/05/2022)

  • Fixes problems with full-day events over different timezones.

v1.8.4 (04/30/2022)

  • Security patch for grunt

v1.8.3 (04/23/2022)

  • Minor style fixes
  • Closing lists on screen resize

v1.8.2 (04/19/2022)

  • Bugfixes

v1.8.1 (04/18/2022)

  • Fixing 3D issues with Safari

v1.8.0 (04/18/2022)

  • New button style on hover as well as smaller changes to the code structure as well as some fixes.

v1.7.7 (04/15/2022)

  • Optimizing it for touch. No longer closing an open list when only scrolling.

v1.7.5 (04/10/2022)

  • Stripping HTML tags (except) to clean up any mess external tools (e.g. Apple’s Safari or Browser extensions) might do to the JSON.

v1.7.4 (04/09/2022)

  • Extending the date+time support from schema.org setups to all implementations.
  • Auto-cleaning date and time strings from seconds and milliseconds.

v1.7.3 (04/09/2022)

  • Adding css files to export statement.
  • test step to support server side rendering
  • Minor fixes

v1.7.2 (03/17/2022)

  • Fixing some styling issues
  • Optimizing code structure

v1.7.1 (03/17/2022)

  • Fixes and changes to new v1.7 export magic.

v1.7.0 (03/17/2022)

  • Rework of general code structure
  • New way to use the logic with custom elements/buttons
  • tons of optimization

v1.6.4 (03/14/2022)

  • Fixing bugs, which broke events that missed description or location

v1.6.3 (03/08/2022)

  • bug fixes, import optimization

v1.6.2 (03/04/2022)

  • Removing real in-code line breaks before parsing the innerHTML JSON to prevent parsing errors. You can still add line breaks to the description in the documented way (using or \n explicitely)

You Might Be Interested In:


Leave a Reply