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

react-daypicker

v3.0.10

Published

A simple datepicker inspired by Pikaday.

Downloads

2,176

Readme

react-daypicker

License Downloads minified size minzipped size

npm badge

A simple datepicker inspired by Pikaday.

DayPicker

Try it yourself at the Storybook.

Version 3 is a breaking change

With version 3.0.0, all external dependencies are removed except react (as a peer). That means for you as a consumer that the active prop which was a moment date is now expected to be a vanilla JavaScript date.

Installation

npm

npm install --save react-daypicker

yarn

yarn add react-daypicker

Agnostic building block

Note that this component does not draw any border around itself or handle popping up. That is up to you. I am using it with react-bootstrap v3 and it my usage looks like this:

Usage

Usage

import 'react-daypicker/lib/DayPicker.css';
import DayPicker from 'react-daypicker';

The only required property is onDayClick which is called when a day is clicked.

<DayPicker onDayClick={(day) => this.setState({ day })} />

An optional property active can be added in order to mark a day as active:

<DayPicker
  active={new Date()}
  onDayClick={(day) => this.setState({ day })}
/>

Note that active is expected to be an instance of Date. In prior version of this component, it was expected to be a Moment.js wrapped date but that is no longer the case.

Passing in custom month and day names

A couple of optional props allow passing in custom month, day and short day names. There isn't any error handling around these props yet so be sure that you pass in 12 months and 7 days. The props are:

monthNames

Set monthNames prop to an Array of 12 strings which will be used for the month names.

Default: ['January', ... , 'December']

longDayNames

Set longDayNames prop to an Array of 7 strings which will be used for the long day names. Note that you need to hover over the short day name to see this long day name. Note the first day must be the equivalent of Sunday.

Default: ['Sunday', ..., 'Saturday']

shortDayNames

Set shortDayNames prop to an Array of 7 strings which will be used for the short day names. Note the first day must be the equivalent of Sunday.

Default: ['Sun', ..., 'Sat']

Options on styling

You can import the Sass stylesheet instead:

import 'react-daypicker/src/DayPicker.scss';

The root element is .react-daypicker-root. The default styling is intentionally monochrome and basic so that you can drop it into your project without having to fiddle with styles right away.

This is likely to change in the future with a probable move to styled-components or something similar.

Dependencies

Peer

  • React

Developing

See package.json for details but simply run npm run watch (if changing code, doesn't work for styles yet) or npm run build.