Socket
Socket
Sign inDemoInstall

react-ts-timepicker

Package Overview
Dependencies
23
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-ts-timepicker

Simple timepicker for React


Version published
Weekly downloads
32
increased by14.29%
Maintainers
1
Install size
554 kB
Created
Weekly downloads
 

Readme

Source

React TS Timepicker

npm version dependencies Build Status Coverage Status

This is a lightweight and easy to use time picker without dependencies for React, written in Typescript and thoroughly covered by unit tests.

Demo

https://codesandbox.io/s/52ll738ljk

Installation

Install plugin with npm:

$ npm install react-ts-timepicker

Or yarn:

$ yarn add react-ts-timepicker

Compatibility

React 15.6+

Basic usage

import React, { Component } from 'react';
import TimePicker from 'react-ts-timepicker';

class App extends Component {
  state = {
    value: '10:00',
  }
 
  onChange = value => {
    this.setState({ value })
  }
 
  render() {
    return (
      <div>
        <TimePicker
          onChange={this.onChange}
          value={this.state.value}
        />
      </div>
    );
  }
}

Configuration

PropertyTypeDefault valueDescription
valuestring / Date / nullnullThe value of the input.
timeFormatstringhh:mmamoment.js like time format string. See below for more information.
namestringtimepickerThe name of the input.
onChangefunction() => {}Function called when the user picks a valid time. Type of the value will be the same as value has.
stepnumber30Step in minutes between two suggestions.
minTimestring / nullnullSuggestions start time.
maxTimestring / nullnullSuggestions end time. Without this prop suggestions max time equals one day.
includeMaxbooleantrueWhether or not include suggestions max time.
hideOnScrollbooleanfalseWhether or not hide suggestions on window scroll.
allowOnlySuggestionsbooleanfalseAllow on suggestions values to be entered to the input. Input value will be rounded to the nearest suggestion.
classNamestring''Class name of the wrapping div. Can be used for overriding default time picker styles.
inputClassstring''Class name of the input element.
appendTostring / nullbodyElement where the suggestions are appended. Takes either string to use as a selector or null to append suggestions to time picker wrapper itself.

Time formats

InputExampleDescription
H HH0..23Hours (24 hour time)
h hh1..12Hours (12 hour time used with a A.)
a Aam pmPost or ante meridiem (Note the one character a p are also considered valid)
m mm0..59Minutes
s ss0..59Seconds

License

This project is licensed under the MIT License .

Keywords

FAQs

Last updated on 23 Feb 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc