Skip to content

๐ŸŒˆ A React prop-type to validate the value, min, and max attributes of <input /> elements with type="date".

License

Notifications You must be signed in to change notification settings

joeyschroeder/date-input-prop-type

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

11 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

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! ๐Ÿค 

About

๐ŸŒˆ A React prop-type to validate the value, min, and max attributes of <input /> elements with type="date".

Resources

License

Stars

Watchers

Forks

Packages

No packages published