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

simple-ts-date-picker

v1.1.1

Published

An simple best extensible typescript react datepicker

Readme

SimpleTsDatepicker

npm version Bundlephobia Bundlephobia

Super simple but extensible datepicker

To get a simple idea about the default behavior check the demo: https://codesandbox.io/s/8nk47k5z29

Components

This repo is split up in a few different sections, first the components section: https://github.com/DJWassink/SimpleDatePicker/tree/master/src/components

Here are some stateless components which are each responsible for rendering a part of the datepicker,

  1. abbreviations.tsx is responsible for rendering the abbreviations of easy weekday
  2. day.tsx is responsible for redering a single cell in the datepicker, typically containing an number indicating the day of month.
  3. header.tsx the default header contains two chevrons to navigate between the months and has two select dropdown to quickly navigate the months and 8 years up/down
  4. stateless_datepicker.tsx is responsible for rendering each day.tsx in order of the passed matrix of dates, this component is the main container and gets passed the abbreviations, header and an function to render a single day.tsx

All of these components can be imported/overwritten to fit your needs. The most user friendly component is the statefull component called SimpleDatePicker which uses all these components to render a datepicker as can be seen here: https://codesandbox.io/s/8nk47k5z29 this component has the following props:

interface SimpleDatePickerProps {
    i18n?: I18n;
    value: Date;
    weekStart?: number;
    onChange: (value: Date) => void;

    renderHeader?: (i18n: I18n, screen: Date, onScreenChange: (screen: Date) => void) => JSX.Element;
    renderAbbreviations?: (i18n: I18n, weekStart: number) => JSX.Element;
    renderDay?: (
        day: Date,
        value: Date,
        screen: Date,
        cursor: Date,
        onClick: () => void,
        onMouseMove: () => void
    ) => JSX.Element;
}

As you can see the only required props are the value and onChange properties. The other props are used to customize the default behavior of the datepicker. The renderXXX props are used to be able to overwrite an existing part of the datepicker, an good example can be seen here: https://codesandbox.io/s/621v1nw0l3

Utils

The utils file contains a few utility functions which are used by the different components, the most noteworthy functions are the following:

  1. generateMatrix = (date: Date, weekStart: number): Date[][] which generates a 7 (width) by 6 (height) matrix containing all the dates for a month, the date params indicates the month adn the weekStart is an number which indicates on which day a week starts (for example 1 means monday).
  2. isInMatrix = (matrix: Date[][], date: Date): boolean simply check if the given day exists in the given matrix.
  3. getFirstDayOfMonth = (date: Date): Date return a date which has the day set to the first day of the month given by the date paramter.
  4. getFirstDayOfWeek = (date: Date, weekStart: number): Date returns the first day of a week, usefull in combination with getFirstDayOfMonth, if you first do the firstDayOfMonth and then this function you get the most to left date in the datepicker.

Of course there are a few more interesting functions, just see the code which do what and which are usefull.

i18n

It is possible to add your own translations, default we use the english translations which you can find in https://github.com/DJWassink/SimpleTsDatePicker/blob/master/src/i18n.ts, if you want your own translations simply copy the I18n const from that file and translate it. Then pass it as the i18n parameter to the datepicker component.