Argon Calendar
A customizable calendar component hackable to its core.

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',
weekStartsFrom: 0,
wrapTarget: false,
numberOfCalendars: 2,
rangeSelection: false,
showHeader: true,
showFooter: true,
calendarWrap() { ... },
calendarRoot() { ... },
calendarHeader() { ... },
calendarFooter() { ... },
calendarBodyRoot() { ... },
dayElement(day) { ... },
dateElement(dateString, dateObject) { ... },
monthElement(monthString, dateObject) { ... }
});
Navigate forward or backward
calendar.prev(1 );
calendar.next(1 );
Set a date
A single date can be set if rangeSelection
is turned off.
calendar.setDate();
Set a date range
A date range can be set if rangeSelection
is turned on.
calendar
.setStartDate()
.setEndDate()
.jumpTo();
Get current date
const currentDate = calendar.getDate();
Get date range
const startDate = calendar.getStartDate();
const endDate = calendar.getEndDate();
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:
- Range selection by clicking date elements
- Automatically populate input fields
- 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.