🌈 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
- Joey Schroeder - Initial work - joeyschroeder.com
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! 🤠