$ yarn add use-input-mask
# or
$ npm i use-input-mask
import React from 'react'
import useInputMask from 'use-input-mask'
import { createAutoCorrectedDatePipe } from "text-mask-addons";
const MyDateInput = props => {
const input = useRef(null);
const autoCorrectedDatePipe = createAutoCorrectedDatePipe("dd/mm/yyyy HH:MM");
const onChange = useInputMask({
input,
onChange: props.onChange,
mask: [/\d/, /\d/, "/", /\d/, /\d/, "/", /\d/, /\d/, /\d/, /\d/],
pipe: autoCorrectedDatePipe,
keepCharPositions: true
});
return <input {...props} ref={input} onChange={onChange} />;
};
export default MyDateInput
- tests
- ci/cd
- semantic-release
- docs
- all-contributors
Thanks goes to these wonderful people (emoji key):
Munir Ahmed Elsangedy ๐ป ๐ |
Renato Ribeiro ๐ |
This project follows the all-contributors specification. Contributions of any kind welcome!
MIT