Analog & Digital:
Two types of time components available AnalogTime & DigitalTime .
Picker:
Input field for time selection which pops open the Analog/Digital picker.
Time Display:
For showing only Analog/Digital time display.
Time Format:
Returns time in 12hours or 24hours format.
Live Clock:
Real Time Clock with optional initial value.
Fully Customizable:
Seperate props for changing color & size of time component. For advanced customization, CSS classes can be overridden.
Example (AnalogTime):
importReactfrom'react';import{AnalogTime}from"react-clock-select";functionTimePicker(props){return(<AnalogTimetype={"picker"}// "picker" or "display", default is pickervalue={newDate()}// Date() object or // a valid time string for Date() constructorplaceholder={"Select Time.."}// when 'value' is empty stringhoursFormat={12}// 12 or 24 size={1}// greater than 0, Default is 1.selectorPosition={"top"}// "top", "bottom" or "modal" (Picker only). // Default is bottom.liveUpdater={true}// true or false (Display only).// Default is false.baseColor={"rgb(255,255,255)"}// Color value for clock basehourHandColor={"white"}// Color value for clock baseminuteHandColor={"#FFFFFF"}// Color value for clock basesecondHandColor={"#4d944e"}// Color value for clock baseonConfirm={(e,value)=>{// "e" is the event object// "value" is a JSON// {// time_string: "12:00:00 AM",// hours: "12",// minutes: "00",// seconds: "00",// am_pm: "AM",// } }}/>)}
Example (DigitalTime):
importReactfrom'react';import{DigitalTime}from"react-clock-select";functionTimePicker(props){return(<DigitalTimetype={"picker"}// "picker" or "display", default is pickervalue={newDate()}// Date() object or // a valid time string for Date() constructorplaceholder={"Select Time.."}// when 'value' is empty stringhoursFormat={12}// 12 or 24 size={1}// greater than 0, Default is 1.selectorPosition={"top"}// "top", "bottom" or "modal" (Picker only).// Default is bottom.liveUpdater={true}// true or false (Display only).// Default is false.color={"rgba(24, 24, 24, 0.671)"}// Color value for clock digitsonConfirm={(e,value)=>{// "e" is the event object// "value" is a JSON// {// time_string: "12:00:00 AM",// hours: "12",// minutes: "00",// seconds: "00",// am_pm: "AM",// } }}/>)}
Props (AnalogTime):
Prop
Type
Description
type
String
"picker" for time picker display or "display" for non editable display
value
String/Date()
Sets default time value
placeholder
String
Set placeholder, visible when 'value' is empty string
hoursFormat
Number
Hour format can be either 12 or 24
size
Number
Size of the clock, should be greater than 0, Default is 1
selectorPosition
String
Position of the picker, "top", "bottom" or "modal" (Picker only). Default is bottom.
liveUpdater
Boolean
Live Clock, if "value" prop is provided live time will be initiated from the "value".
baseColor
String
Color value for clock base
hourHandColor
String
Color value for hour hand
minuteHandColor
String
Color value for minute hand
secondHandColor
String
Color value for second hand
onConfirm
Callback
Callback function for date confirm on OK button. value is a JSON