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-datez

v1.4.1

Published

[![NPM](https://nodei.co/npm/react-datez.png)](https://nodei.co/npm/react-datez/) [![npm version](https://badge.fury.io/js/react-datez.svg)](https://badge.fury.io/js/react-datez)

Downloads

1,260

Readme

NPM npm version

react-dates-banner

react-datez

A customizable, flexible and delicious react date picker.

Contibutors Wanted

Always on the lookout for people to help maintain this plugin, please submit PR's and we can make this happen!

Example

react-gif

Features

  • Mobile friendly
  • Redux-form compatible
  • Standalone picker
  • Multi calendar support
  • Disallow past dates
  • Disallow dates outside of a range
  • Weekend highlighting
  • Popup position
  • Year & month jumping
  • Custom date formatting
  • Localization

Roadmap

  • Multi browser support
  • Time Picker
  • Blockout days
  • Location support
  • Animations

How to use

There is currently two ways to implement React-datez, as a redux-form component or a standlone date picker.

npm i --save react-datez

Add css to to your project (uses post-css)

@import 'react-datez/dist/css/react-datez.css';

Than import into your components

import { ReactDatez, ReduxReactDatez } from 'react-datez'

Edit react-datez-demo


Props

ReactDatez.propTypes = {
    input: PropTypes.object,
    style: PropTypes.object,
    inputStyle: PropTypes.object,
    className: PropTypes.string,
    inputClassName: PropTypes.string,
    disableInputIcon: PropTypes.bool,
    disable: PropTypes.bool,
    wrapperStyle: PropTypes.object,
    handleChange: PropTypes.func,
    value: PropTypes.string,
    displayCalendars: PropTypes.number,
    isRedux: PropTypes.bool,
    highlightWeekends: PropTypes.bool,
    allowPast: PropTypes.bool,
    allowFuture: PropTypes.bool,
    startDate: PropTypes.string,
    endDate: PropTypes.string,
    position: PropTypes.oneOf(['center', 'left', 'right']),
    dateFormat: PropTypes.string,
    yearJump: PropTypes.bool,
    placeholder: PropTypes.string,
    defaultMonth: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
    locale: PropTypes.string,
    yearButton: PropTypes.node,
    firstDayOfWeek: PropTypes.oneOf(['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']),
    currentMonthYearFormat: PropTypes.string
}

input

Passed through by redux <Field /> component. Meta is also automatically added to this component to display errors.

style

Add additional style to the wrapper div element

inputStyle

Add additional styles directly on main input element

className

Add additional classes to the wrapper div element

disable

Disables the input

inputClassName

Add additional classes to the main input element

disableInputIcon

Disable the calender icon on input

Default: false

handleChange

Pass through parent onChange function. Omitted if using redux-forms - (See example stand-alone picker).

value

Parent input state. Omitted if using redux-forms - (See example stand-alone picker).

displayCalendars

Show multiple calendars (Max 2).

Default: 1

highlightWeekends

Highlight weekends for visual representation

Default: false

yearJump

Allow year/month button functionality

Default: true

allowPast

Allow dates in the past to be selected.

Default: false

allowFuture

Allow dates in the future to be selected.

Default: true

startDate

Disallow dates before a given date

endDate

Disallow dates after a given date

dateFormat

Format for the date to be displayed and stored as. See moment.js for formatting.

Default: DD/MM/YYYY

position

Positioning of the popup, 'left', 'center', 'right'

Default: 'left'

placeholder

Add a placeholder in the input fields

Default: ''

defaultMonth

Default month when there is no input value. Can be moment object or a moment formatted string.

locale

Change moment locale - This will change the all moment dates to be the locale.

Default: 'en'

yearButton

Change year select button with custom element

firstDayOfWeek

Set the first day of the week, in standard 2 letter format (e.g. Mo, Tu, We, Th, Fr, Sa, Su)

Default: 'Mo'

currentMonthYearFormat

Change month year format on title. See moment.js for formatting.

Default: 'MMMM YYYY'


Redux Forms

<div className="form-group">
    <label htmlFor="exampleDate1">Date</label>
    <Field name="exampleDate1" component={ReduxReactDatez} displayCalendars={2} highlightWeekends />
</div>

Stand-alone Picker

constructor(props) {
    super(props)
    this.state = {
        dateInput: ''
    }
    this.handleChange = this.handleChange.bind(this)
}

handleChange(value) {
    this.setState({ dateInput: value })
}

render() {
    return (
        <div className="form-group">
            <label htmlFor="exampleDate2">Check-in Date</label>
            <ReactDatez name="dateInput" handleChange={this.handleChange} value={this.state.dateInput} />
        </div>
    )
}