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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ts-headless-calendar

v1.0.7

Published

A headless calendar built with typescript

Readme

ts-headless-calendar

A easy to use headless calendar built purely with typescript and no dependencies.

Getting started

Installation

Install the package with

npm install ts-headless-calendar

or

yarn add ts-headless-calendar

User Guide

Start by importing Calendar

import { Calendar } from 'ts-headless-calendar/lib'

Create a calendar instance

import { Calendar } from 'ts-headless-calendar/lib'

const calendar = new Calendar();

How to create iterable for years, months, days and hours

import { Calendar } from 'ts-headless-calendar/lib'

const calendar = new Calendar();

calendar.years(2000, 2022); // Gives you an array containing all YearCalendars in the range (2000, 2022)
calendar.year(2011).months(); // Gives you an array containing all MonthCalendars in the year 2011.
calendar.year(2011).month(0).days(); // Gives you an array containing all DayCalendars for January 2011.
calendar.year(2011).month(0).day(1).hours(); // Gives you an array containing all HourCalendars for January-1-2011

Navigating the calendar

You can navigate the calendar by using the next and previous methods.

NOTE: The HourCalendar currently does not support next and previous.

import { Calendar } from 'ts-headless-calendar/lib'

const calendar = new Calendar();


// Next and previous year
calendar.year(2011).next(); // Gives you the YearCalendar for 2012
calendar.year(2011).previous(); // Gives you the YearCalendar for 2010

// next and previous month
calendar.year(2011).month(0).next(); // Gives you the month calendar for February 2011.
calendar.year(2011).month(1).previous(); // Gives you the month calendar for January 2011.

// wrap around is also supported e.g.:
calendar.year(2011).month(0).previous(); // Gives you the month calendar for December 2010

// next and previous day
calendar.year(2011).month(0).day(10).next(); // Gives you the day calendar for January-11-2011.
calendar.year(2011).month(0).day(10).next(); // Gives you the day calendar for January-9-2011.

// wrap around is also supported e.g.:
calendar.year(2011).month(0).day(1).previous(); // Gives you the day calendar for December-31-2010

Converting to Date objects

All classes have a corresponding Date representation. You can simply call the date() method, to get the corresponding JS Date.

import { Calendar } from 'ts-headless-calendar/lib'

const calendar = new Calendar();


// Next and previous year
calendar.year(2011).date(); // Gives you the JS Date for 2012
calendar.year(2011).month(0).date(); // Gives you the JS Date January 2011.
calendar.year(2011).month(0).day(10).date(); // Gives you the JS Date for January-10-2011.
calendar.year(2011).month(0).day(10).hour(23).date(); // Gives you the JS Date for January-10-2011 23:00.

Documentation

See https://maydmor.github.io/ts-headless-calendar/

License

MIT