npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-bootstrap-time-picker

v2.0.1

Published

Bootstrap Time Picker React Component

Downloads

10,879

Readme

react-bootstrap-time-picker

Time Picker with bootstrap flavor

react-bootstrap-time-picker

npm version Downloads Build Status Coverage Status

Versions

  • v2 supports React Bootstrap v1.0.0+
  • v1 supports React Bootstrap v0.x.x

Demo

Demo and playground are available here

Install

npm i react-bootstrap-time-picker --save

Usage Example

import TimePicker from 'react-bootstrap-time-picker';

<TimePicker start="10:00" end="21:00" step={30} />

Configurable Props

Note: All props are optional.

end: string, default "23:59"

Time Picker renders options with range between start and end time values with step (inclusive).

Should be provided in the following format: "HH?(:mm?(:ss?))".

Valid examples

"4", "04", "4:0", "04:00", "4:0:0", "04:00:00". All these are equal to "4 hours".

Invalid example

"11:00 PM". Should be provided in 24-hour format only

format: number, default "23:59"

Time Format of rendered options. Supported values: 12 or 24.

initialValue: any, default: "00:00"

Initial selected option. Used if value prop is either undefined or null. Can be provided either in "HH?(:mm?(:ss?))" format or as int (hours * 3600 + minutes * 60 + seconds). If initialValue is less than start property value, then start value is used instead.

Valid examples

"1:00", "01:00", "3600", 3600

Invalid examples

"11:00 PM"

onChange: func, default: () => {}

Function, which is triggered after one of options is selected. Return selected time in int format: (hours * 3600 + minutes * 60 + seconds).

Example

class Parent extends React.Component {
  constructor() {
    super();

    this.handleTimeChange = this.handleTimeChange.bind(this);

    this.state = { time: 0 };
  }

  handleTimeChange(time) {
    console.log(time);     // <- prints "3600" if "01:00" is picked
    this.setState({ time });
  }

  render() {
    return <TimePicker onChange={this.handleTimeChange} value={this.state.time} />;
  }
}

start: string, default: "00:00"

See end property description.

step: number, default: 30

Step between time options in minutes. See end property description.

value

Current value. See initialValue description.

Validations

Library doesn't validate provided props much. If you are doing something strange like setting start="10:00", end="05:00", then behavior is undefined, which means that it might render component differently in the future versions. Also underlying library time-number throws exceptions if provided time is not in a proper format, i.e. adl is considered invalid.

License

MIT (c) Yury Dymov