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

argon-calendar

v0.0.5

Published

A customizable calendar component hackable to its core.

Downloads

10

Readme

Argon Calendar

A customizable calendar component hackable to its core.

Build Status

Install

npm i argon-calendar

About

Argon calendar is not a regular calendar plugin. It's a a minimalistic and customizable library with a basic set of APIs. It uses native browser APIs under the hood. If you are looking to build your own calendar plugin, this is the place where you start.

How does it work?

Initialize

import ArgonCalendar from 'argon-calendar';

const calendar = new ArgonCalendar({
    target: '#calendarTarget', // Target where calendar should be rendered. [mandatory]
    weekStartsFrom: 0, // Default: 0. 0 is Sunday, 1 is Monday, and so on... [optional]
    wrapTarget: false, // True for input types. Wrap existing target and place calendar inside the wrapping element. [optional]
    numberOfCalendars: 2, // Default: 1. Number of months to be shown. [optional]
    rangeSelection: false, // Default: false. If "true" then range selection is enabled. [optional]
    showHeader: true, // Enable calendar header. [optional]
    showFooter: true, // Enable calendar footer. [optional]
    calendarWrap() { ... }, // To wrap current input element. Works only for "input" as a target. [optional]
    calendarRoot() { ... }, // Customize calendar top level element. [optional]
    calendarHeader() { ... }, // Customize calendar header. [optional]
    calendarFooter() { ... }, // Customize calendar footer. [optional]
    calendarBodyRoot() { ... }, // Customize calendar body element. [optional]
    dayElement(day) { ... }, // Customize day element (Monday, Tuesday, Wednesday, etc.). [optional]
    dateElement(dateString, dateObject) { ... }, // Customize date element. [optional]
    monthElement(monthString, dateObject) { ... } // Customize month element. [optional]
});

Navigate forward or backward

calendar.prev(1 /* Optional skip parameter */); // Loads previous month(s). Optional "skip" parameter specifies how many months should be skipped.
calendar.next(1 /* Optional skip parameter */); // Loads next month(s). Optional "skip" parameter specifies how many months should be skipped.

Set a date

A single date can be set if rangeSelection is turned off.

calendar.setDate(/* Date object OR valid Date constructor arguments */);

Set a date range

A date range can be set if rangeSelection is turned on.

calendar
    .setStartDate(/* Date object OR valid Date constructor arguments */)
    .setEndDate(/* Date object OR valid Date constructor arguments */) // These two methods will not re-render months
    .jumpTo(/* Date object representing first month in the view */); // You should call this method to re-render months and diplay date range

Get current date

const currentDate = calendar.getDate(); // Works if "rangeSelection" is turned off.

Get date range

const startDate = calendar.getStartDate(); // Works if "rangeSelection" is turned on.
const endDate = calendar.getEndDate(); //  Works if "rangeSelection" is turned on.

Get today's date

const today = calendar.getToday();

Destroy calendar

calendar.destroy();

Important!

Argon calendar does not support (and probably will never support) following features:

  1. Range selection by clicking date elements
  2. Automatically populate input fields
  3. Display calendar as a popup

Please note that argon calendar does not assume how your calendar component should behave or look like. It provides a set of APIs which are crucial for a a calendar plugin to work. The plugin part is what you need to build yourself.

Your contribution

Argon calendar is a simple library, easy to understand and use. However, if you still face any issues, please feel free to log defects, provide suggestions or raise PRs. I would highly appreciate your contribution towards this project.