react-simple-timefield
Simple React time input field, check out demo.
Installation
npm install --save react-simple-timefield #for React <16 use: npm install --save react-simple-timefield@1
Usage
import TimeField from 'react-simple-timefield';...<TimeField = // , '00:00' '00:00:00' = // = // < ="text" /> colon=":" // {String} default: ":" showSeconds // {Boolean} default: false/>
Real world example
import TimeField from 'react-simple-timefield'; Component { ; thisstate = time: '12:34' ; thisonTimeChange = thisonTimeChange; } { this; } { const time = thisstate; return <TimeField = = /> ; }
Changelog
- 2.0.0 React v16 support
- 1.3.0 Added custom colon property
- 1.2.0 Added custom input field property
- 1.1.0 Added
showSeconds
property - 1.0.0 Initial release
Contributing
Run demo:
For running demo locally, replace:
;// to;
in demo/index.js
file.
# run development mode cd demonpm run dev
Build:
npm testnpm run formatnpm run build
Todo
- Support full time format with seconds
- Tests
- Custom input field (like Material UI TextField)
- Custom colon
- Support for Date object as value
License
MIT License. Free use and change.