Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

rc-time-picker

react-component708.4k3.7.3TypeScript support: included

React TimePicker

react, react-time-picker, react-component, timepicker, time-picker, ui component, ui, component

readme

TimePicker

React TimePicker

NPM version build status Test coverage Dependencies DevDependencies npm download

example

http://react-component.github.io/time-picker/

install

npm install rc-time-picker

Usage

import TimePicker from 'rc-time-picker';
import ReactDOM from 'react-dom';
import 'rc-time-picker/assets/index.css';
ReactDOM.render(<TimePicker />, container);

API

TimePicker

Name Type Default Description
prefixCls String 'rc-time-picker' prefixCls of this component
clearText String 'clear' clear tooltip of icon
disabled Boolean false whether picker is disabled
allowEmpty Boolean true allow clearing text
open Boolean false current open state of picker. controlled prop
defaultValue moment null default initial value
defaultOpenValue moment moment() default open panel value, used to set utcOffset,locale if value/defaultValue absent
value moment null current value
placeholder String '' time input's placeholder
className String '' time picker className
id String '' time picker id
popupClassName String '' time panel className
popupStyle object {} customize popup style
showHour Boolean true whether show hour
showMinute Boolean true whether show minute
showSecond Boolean true whether show second
format String - moment format
disabledHours Function - disabled hour options
disabledMinutes Function - disabled minute options
disabledSeconds Function - disabled second options
use12Hours Boolean false 12 hours display mode
hideDisabledOptions Boolean false whether hide disabled options
onChange Function null called when select a different value
onAmPmChange Function null called when select an am/pm value
addon Function - called from timepicker panel to render some addon to its bottom, like an OK button. Receives panel instance as parameter, to be able to close it like panel.close().
placement String bottomLeft one of ['topLeft', 'topRight', 'bottomLeft', 'bottomRight']
transitionName String ''
name String - sets the name of the generated input
onOpen Function({ open }) | when TimePicker panel is opened
onClose Function({ open }) | when TimePicker panel is closed
hourStep Number 1 interval between hours in picker
minuteStep Number 1 interval between minutes in picker
secondStep Number 1 interval between seconds in picker
focusOnOpen Boolean false automatically focus the input when the picker opens
inputReadOnly Boolean false set input to read only
inputIcon ReactNode | specific the select icon.
clearIcon ReactNode | specific the clear icon.

Test Case

npm test
npm run chrome-test

Coverage

npm run coverage

open coverage/ dir

License

rc-time-picker is released under the MIT license.

changelog

History

3.7.2 / 2019-08-28

  • Fix React lifecycle wanring. #163

3.7.0 / 2019-06-13

  • Improve accessibility. #153

3.6.0

  • Refacotr dom structure.

3.5.0 / 2018-12-23

  • Add popupStyle
  • Add onAmPmChange
  • Add Typescript definition

3.4.0 / 2018-08-13

  • Add inputIcon

3.3.0 / 2018-02-08

  • Add inputReadOnly

3.2.0 / 2017-11-15

  • Add blur() and autoFocus.

3.1.0 / 2017-11-02

3.0.0 / 2017-10-22

  • Support React 16.
  • Add onKeydown.
  • Add focusOnOpen.
  • Add hourStep minuteStep secondStep.
  • Fix disabled style.
  • Use this.xxx to replace this.refs.xxx.

2.4.0 / 2017-05-02

Add popupClassName prop.

2.3.0 / 2017-03-08

Add use12Hours prop.

2.2.0 / 2016-11-11

Add showMinute prop.

2.1.0 / 2016-10-25

Add addon prop.

2.0.0 / 2016-08-04

goodbye gregorian-calendar, hello moment

1.1.0 / 2016-01-14

remove gregorianCalendarLocale prop, move to locale.calendar

1.0.0 / 2015-12-21

release!

1.0.0-alpha9 / 2015-12-16

fixed update bugs when value empty.

1.0.0-alpha7 / 2015-12-12

new add options disabledHours, disabledMinutes, disabledSeconds and hideDisabledOptions. remove remove options hourOptions, minuteOptions and secondOptions.

1.0.0-alpha2 / 2015-12-03

fixed IE8 compatible. new add test users.

0.7.1 / 2015-11-20

fixed change value to null when clear input content to remove the react warning.

0.7.0 / 2015-11-20

update change the className of panel and its container.

0.5.6 / 2015-11-19

fixed use another method to change time and fix the bug about value.getTime().

0.5.4 / 2015-11-19

update change value prop to defaultValue.

0.5.2 / 2015-11-19

update renew placements config.

0.5.1 / 2015-11-19

update change the className of select panel container.

0.5.0 / 2015-11-19

update clear input content and close select panel when click [x] on select panel.

new can custom input className now.

0.4.0 / 2015-11-18

update clear input content when click [x] on select panel.

0.3.3 / 2015-11-17

fixed fix some bugs.

0.3.0 / 2015-11-17

update remove TimePanel and merge it to TimePicker.

0.2.0 / 2015-11-16

update rename the component, update document.

0.1.0 / 2015-11-12

new #305 release 0.1.0 (@wuzhao)