0.1.0 • Published 10 years ago

time-pikinator v0.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

Time Pikinator

React/HTML5 component for picking a time. Uses the time input type, w/ a fallback to a datalist of times.

Install

$> npm install time-pikinator

Example

Also see demo.js

var React = require('react')
  , TimePicker = require('./index')
  , div = React.DOM.div
  , moment = require('moment')
  ;

var App = React.createClass({
  getInitialState: function() {
    return { value: '' }
  },

  handleTimeChange: function(event) {
    if (event.isValid) {
      this.setState({ value: event.value })
    }
  },

  render: function() {
    return div({}, [
      TimePicker({ key: 1, onChange: this.handleTimeChange, value: this.state.value }),
      div({}, ["This selected time: " + this.state.value])
    ]);
  }
});

React.renderComponent(
  App({}),
  document.body
);