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

react-simple-date-picker

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-simple-date-picker

react-simple-date-picker

  • 0.1.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

react-simple-date-picker

A simple, modular React date picker component

react-simple-date-picker

Installation

The package can be installed via NPM:

npm i -S react-simple-date-picker

Usage

import React from 'react';
import DatePicker from 'react-simple-date-picker';

const MyForm = () => (
  <form className="MyForm" onSubmit={(e) => {
    const dateInput = e.target.querySelectorAll('input[name$="date"]')[0];
    // dateInput.value is formatted as a YYYY-MM-DD string by default
    doSomething(dateInput.value);
  }}>
    <DatePicker />
    <button type="submit">Submit</button>
  </form>
);

export default MyForm;

Customization

This DatePicker component is built simple on purpose. It's intended to be built upon. However, there are some pieces that are customizable right out of the box.

These customizable props include:

  • dirty: should the currently selected date be shown (highlighted cell) [defaults to true]
  • inputName: the html input element's "name" property [defaults to 'date']
  • showDateReset: show the reset button [defaults to true]
  • showDateSelected: show the currently selected date in a human readable string [defaults to true]
  • showWeekDayName: show the abbreviated week names at the top of the calendar [defaults to true]
  • showMonthChangeButtons: show the left/right arrow buttons for changing the month [defaults to true]
  • showYearChangeButtons: show the up/down arrow buttons for changing the year [defaults to true]
  • initialDate: the initially selected date (Date) [defaults to new Date()]

Usage With Custom Props

  ...
  <DatePicker
    inputName="MyForm_date"
    showDateReset=false
    showDateSelected=false
    initialDate={new Date('2021-01-20')}
  />
  ...

Continuous Development

If you'd like to build upon the existing component (and you should!), you can find all the applicable files within the src directory, with all the React components located within the components directory.

Scripts

npm start to start a dev server
npm run build to create a production build
npm run build-dev to create a dev build

FAQs

Package last updated on 08 May 2017

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