timepoint-selection
Enhance input elements with easy key entry and validation for time durations. Library is in pure javascript, no framework is needed. Event handlers are added directly to the input and the package includes a destroy method to remove all added events.
- Input numbers directly or increment and decrement with up and down arrow keys.
- Left and right arrow keys navigate through the input selecting the next important character for entry.
- Rollover is automatically handled.
- Tabbing into an element automatically selects the first character in the input for easier entry.
- Non-valid characters are prevented from input.
Installation
npm install timepoint-selection
Basic Usage
var selection = ; var timepoint = ; //returns the current value of the input in seconds.timepoint; //sets the current value of the input in seconds.timepoint; //remove all the event listeners from the input.timepoint;
Accepted duration formats:
- 'dd:hh:mm:ss'
- 'dd:hh:mm'
- 'hh:mm:ss'
- 'hh:mm'
- 'mm:ss'
d = days, h = hours, m = minutes, s = seconds
Examples
Development
npm run start
runs the webpack dev server.