Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including timepoint-selection with all npm packages installed. Try it out:

var timepointSelection = require("timepoint-selection")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

timepoint-selection v0.2.2

Key controlled time input duration 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.




npm install timepoint-selection

Basic Usage

var selection = require('timepoint-selection');

var timepoint = selection(document.getElementById("input"), {
    'durationFormat': 'hh:mm:ss',
    'max': 3600 * 24,               // point of rollover in seconds.
    'value': 0,                     // initial value of input in seconds.
    'useAbbr': true,                // configure the separator to not be ':'
    'abbr': {                       // pass in custom separator (with trailing space if desired)
      'dd': 'days ',
      'hh': 'h ',
      'mm': 'm ',
      'ss': 's'

//returns the current value of the input in seconds.

//sets the current value of the input in seconds.

//remove all the event listeners from the input.

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


Demo site


npm run start runs the webpack dev server.


MIT License

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free