date-input-prop-type

0.2.1 • Public • Published

npm npm downloads license GitHub issues GitHub stars code style: prettier tested with jest Dependency status devDependency status

🌈 Date Input Prop Type

A React & React Native prop-type to validate the value, min, and max attributes of <input> elements with type="date".

Installation

npm install date-input-prop-type --save

Usage

Import dateInputPropType

import { dateInputPropType } from 'date-input-prop-type';

Use as follows:

import React, { Component } from 'react';
import { dateInputPropType } from 'date-input-prop-type';

export class YourComponent extends Component {
  static propTypes = {
    max: dateInputPropType,
    min: dateInputPropType,
    value: dateInputPropType
  }

  static defaultProps = {
    max: '2020-01-01',
    min: '1989-06-28',
    value: '2019-01-01'
  }

  ...

  render() {
    const { value, min, max } = this.props;
    return <input type="date" value={value} min={min} max={max} />;
  }
}

Versioning

I use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

Contributing

Please submit a pull request with any features/fixes for the project. I apologize in advance for the slow action on pull requests and issues. Please follow the ESLint rules for the project.

License

This project is licensed under the MIT License - see the MIT Open Source Initiative for details.

Acknowledgments

Hat tip to anyone who's code was used! 🤠

Package Sidebar

Install

npm i date-input-prop-type

Weekly Downloads

1

Version

0.2.1

License

MIT

Unpacked Size

6.29 kB

Total Files

4

Last publish

Collaborators

  • joeyschroeder