Skip to content

A first calendar

Everything you need to see calendaryjs working. No plugins.

import { calendary } from "calendaryjs";
const cal = calendary();
// Add events into a named group.
cal.addGroup({
id: "holidays",
name: "Holidays",
events: [
{ type: "const", id: "newyear", month: 1, day: 1, title: "New Year" }, // every Jan 1
{ type: "const", id: "xmas", month: 12, day: 25, title: "Christmas" },
],
});
// One day.
cal.getEvents("2026-12-25").map(e => e.title); // → ["Christmas"]
// A range (recurrences are expanded for the window you ask for).
cal.getEventsInRange("2026-01-01", "2026-12-31").length; // → 2
// A day object, events sorted by priority.
cal.getDay("2026-01-01").events[0].title; // → "New Year"
// Fluent query — text / type / status / source / group, always range-bounded.
cal.search().group("holidays").range("2026-01-01", "2026-12-31").getEvents();

Each computed event carries its groupId, date, and type, so you can colour or filter by group and kind in your UI. Next: recurring patterns »