Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-daypicker

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-daypicker

A simple datepicker inspired by Pikaday.

  • 3.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
136
decreased by-41.63%
Maintainers
1
Weekly downloads
 
Created
Source

react-daypicker

License Downloads minified size minzipped size

npm badge

A simple datepicker inspired by Pikaday.

DayPicker

v3.0.0 is a breaking change

With v3.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. However, for date equality reasons, active is expected to be a day so you must pass in a Date instance with no more accuracy beyond date set.

Example:

<DayPicker active={new Date(2018, 11, 1)} />

(remember with JavaScript, months start at 0 so 11 is December)

Installation

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

npm

npm install --save react-daypicker

yarn

yarn add react-daypicker

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(2018, 11, 1)}
  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.

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.

Keywords

FAQs

Package last updated on 20 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc