npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@wycliffeusa/add-to-calendar-buttons

v1.0.0

Published

A simple JS library that enables you to add an "add to calendar" button for your upcoming events - forked from commonpike

Downloads

212

Readme

OuiCal2

A simple JS library that enables you to add an "add to calendar" button for your upcoming events.

Inspiration

This project was inspired by Eventbrite's add to calendar feature (which should have been open sourced #justSayin).

Later, it was adjusted to look and behave more like AddToCalendar, which suddenly became a commercial tool, and very expensive too #justSayin.

How to use it?

Method 1

Call 'addToCalendar' with your event info, pass in any optional parameters such as a class and/ or id and boom! Insert your add-to-calendar div wherever you'd like.

The only fields that are mandatory are:

  • Event title
  • Start time

Example

var myCalendar = addToCalendar({
  options: {
    class: 'my-class',
    
    // You can pass an ID. If you don't, one will be generated for you
    id: 'my-id'
  },
  data: {
    // Event title
    title: 'Get on the front page of HN',

    // Event start date
    start: new Date('June 15, 2013 19:00'),
    
    // Event timezone. Will convert the given time to that zone
    timezone: America/Los_Angeles,          

    // Event duration (IN MINUTES)
    duration: 120,

    // You can also choose to set an end time
    // If an end time is set, this will take precedence over duration
    // end: new Date('June 15, 2013 23:00'), 
    
    // You can also choose to set 'all day'
    // If this is set, this will override end time, duration and timezone
    // allday:true,

    // Event Address
    address: 'The internet',

    // Event Description
    description: 'Get on the front page of HN, then prepare for world domination.'
  }
});

document.querySelector('#place-where-I-want-this-calendar').appendChild(myCalendar);

Method 2

Write your events data in several hidden HTML tags with the right classnames, and wrap them in a div. Then call 'createCalendar' with the outer div and boom! The calendar is appended to your wrapping div. The only fields that are mandatory are:

  • Event title

  • Start time

Example

<div title="Add to Calendar" class="add-to-calendar">
  <span class="start">12/18/2018 08:00 AM</span>
  <span class="timezone">America/Los_Angeles</span>
  <!--span class="end">12/18/2018 10:00 AM</span-->
  <!--span class="duration">60</span-->
  <!--span class="allday">true</span-->
  <span class="title">Summary of the event</span>
  <span class="description">Description of the event</span>
  <span class="location">Location of the event</span>
</div>

method 3

If you are ony interested in the data, call 'addToCalendarData' with your event info, pass in any optional parameters as described in method #1. An object with some html links is returned.

Example

var caldata = addToCalendarData({
  data: {
    // Event title
    title: 'Get on the front page of HN',

    // Event start date
    start: new Date('June 15, 2013 19:00'),
    
    //.. and the rest was optional.
    
  }
});
console.log(caldata);

Demo

Here is a live example

Calendar Generator

Need to generate an add-to-calendar widget on the fly? No problem, go here.

GitHub Project Page

Official Project Page

License

MIT