Giter VIP home page Giter VIP logo

timepoint-selection's Introduction

#timepoint-selection

npm

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.

Screenshot

Screenshot

Installation

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.
timepoint.getValue();

//sets the current value of the input in seconds.
timepoint.setValue(seconds);

//remove all the event listeners from the input.
timepoint.destroy();

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

Demo site

Development

npm run start runs the webpack dev server.

License

MIT License

timepoint-selection's People

Contributors

mdtanrikulu avatar naomiaro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

timepoint-selection's Issues

Disable AM, PM default hours, with color HH:MM

Hi, I have user who just want to enter amount of time worked, i.e. how long and not when.

I was unable to disable the AM & PM text, can you please share the setting/example to disable it.

Also

  • how to show default hours: for e.g. on select box, default to 08:00 hrs.
  • Different color for hours (Blue) and Mins (green)
  • show a button to fill https://github.com/kbwood/timeentry/blob/master/jquery.timeentry.js
    image

thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.