TimePicker is an intuitive interface component which provides an options to select a time value from popup list or to set a desired time value.
<input id='timepicker' type='text'/>
<script>
var timePickerObj = new TimePicker({ value: new Date() });
timePickerObj.appendTo('#timepicker');
</script>
boolean
Support for
allowEdit
has been provided fromv16.2.46
. Specifies whether the input textbox is editable or not. Here the user can select the value from the popup and cannot edit in the input textbox.
Defaults to true
string
Specifies the root CSS class of the TimePicker that allows to customize the appearance by overriding the styles.
Defaults to null
boolean
Specifies whether it is a masked timepicker or not. By default the timepicker component render without masked input. If you need masked timepicker input then specify it as true.
Defaults to false
boolean
Enable or disable the persisting component’s state between the page reloads. If enabled, following list of states will be persisted.
Defaults to false
boolean
Enable or disable rendering component in right to left direction.
Defaults to false
boolean
Specifies whether the component to be disabled or not.
Defaults to true
FloatLabelType
| string
Specifies the placeholder text to be floated. Possible values are: Never: The label will never float in the input when the placeholder is available. Always: The floating label will always float above the input. Auto: The floating label will float above the input after focusing or entering a value in the input.
Defaults to Syncfusion.EJ2.Inputs.FloatLabelType.Never
string
| TimeFormatObject
Specifies the format of value that is to be displayed in component. By default, the format is based on the culture.
For more details refer to
Format
documentation.
<input id="timepicker" type="text">
import { TimePicker } from '@syncfusion/ej2-calendars';
let timepicker: TimePicker = new TimePicker({
format: { skeleton: 'Hms' }
});
timepicker.appendTo('#timepicker');
Defaults to null
boolean
Specifies the component popup display full screen in mobile devices.
Defaults to false
{ : }
You can add the additional html attributes such as disabled, value etc., to the element. If you configured both property and equivalent html attribute then the component considers the property value.
<input id="timepicker" type="text">
import { TimePicker } from '@syncfusion/ej2-calendars';
let timepicker: TimePicker = new TimePicker({
htmlAttributes: { name: "period", placeholder:"Select a time" }
});
timepicker.appendTo('#timepicker');
Defaults to {}
{ : }
Customizes the key actions in TimePicker. For example, when using German keyboard, the key actions can be customized using these shortcuts.
Key action |
Key |
enter |
enter |
escape |
escape |
end |
end |
tab |
tab |
home |
home |
down |
downarrow |
up |
uparrow |
left |
leftarrow |
right |
rightarrow |
open |
alt+downarrow |
close |
alt+uparrow |
<input id="timepicker" type="text">
import { TimePicker } from '@syncfusion/ej2-calendars';
let timepicker: TimePicker = new TimePicker({
keyConfigs:{
enter: "space",
home: "ctrl+home",
end: "ctrl+end"
}
});
timepicker.appendTo('#timepicker');
Defaults to null
string
Overrides the global culture and localization value for this component. Default global culture is ‘en-US’.
Defaults to ”
Specifies the mask placeholder to be displayed on masked timepicker.
Defaults to {day:‘day’ , month:‘month’, year: ‘year’, hour:‘hour’,minute:‘minute’,second:‘second’,dayOfTheWeek: ‘day of the week’}
Date
Gets or sets the maximum time value that can be allowed to select in TimePicker.
For more details refer to
Time Range
documentation.
Defaults to 00:00
Date
Gets or sets the minimum time value that can be allowed to select in TimePicker.
For more details refer to
Time Range
documentation.
Defaults to 00:00
boolean
By default, the popup opens while clicking on the timepicker icon. If you want to open the popup while focusing the time input then specify its value as true.
Defaults to false
string
Specifies the placeholder text that is displayed in textbox.
Defaults to null
boolean
Specifies the component in readonly state.
Defaults to false
Date
Specifies the scroll bar position if there is no value is selected in the popup list or the given value is not present in the popup list.
For more details refer to
Time Duration
sample.
<input id="timepicker" type="text">
import { TimePicker } from '@syncfusion/ej2-calendars';
let timepicker: TimePicker = new TimePicker({
scrollTo: new Date("1/1/2018 5:30 PM")
});
timepicker.appendTo('#timepicker');
Defaults to null
number
By default, the time value will be processed based on system time zone.
If you want to process the initial time value using server time zone
then specify the time zone value to serverTimezoneOffset
property.
Defaults to null
boolean
Specifies whether to show or hide the clear icon.
Defaults to true
number
Specifies the time interval between the two adjacent time values in the popup list.
For more details refer to
Format
documentation.
Defaults to 30
boolean
Specifies the component to act as strict so that, it allows to enter only a valid time value within a specified range or else resets to previous value. By default, strictMode is in false.
For more details refer to
Strict Mode
documentation.
Defaults to false
Date
Gets or sets the value of the component. The value is parsed based on the culture specific time format.
Defaults to null
string
| number
Gets or sets the width of the TimePicker component. The width of the popup is based on the width of the component.
Defaults to null
number
specifies the z-index value of the timePicker popup element.
Defaults to 1000
Adds the handler to the given event listener.
Parameter | Type | Description |
---|---|---|
eventName | string |
A String that specifies the name of the event |
handler | Function |
Specifies the call to run when the event occurs. |
Returns void
Appends the control within the given HTML element
Parameter | Type | Description |
---|---|---|
selector (optional) | string | HTMLElement |
Target element where control needs to be appended |
Returns void
Adding unload event to persist data when enable persistence true
Returns void
When invoked, applies the pending property changes immediately to the component.
Returns void
Removing unload event to persist data when enable persistence true
Returns void
Focused the TimePicker textbox element.
Returns void
Focuses out the TimePicker textbox element.
Returns void
Returns the persistence data for component
Returns any
Gets the properties to be maintained upon browser refresh.
Returns string
Returns the route element of the component
Returns HTMLElement
Handling unload event to persist data when enable persistence true
Returns void
Hides the TimePicker popup.
Returns void
Applies all the pending property changes and render the component again.
Returns void
Removes the handler from the given event listener.
Parameter | Type | Description |
---|---|---|
eventName | string |
A String that specifies the name of the event to remove |
handler | Function |
Specifies the function to remove |
Returns void
Opens the popup to show the list items.
Returns void
Dynamically injects the required modules to the component.
Parameter | Type | Description |
---|---|---|
moduleList | Function[] |
? |
Returns void
EmitType<BlurEventArgs>
Triggers when the control loses the focus.
Triggers when the value is changed.
Triggers when timepicker value is cleared using clear button.
Triggers when the popup is closed.
EmitType<Object>
Triggers when the component is created.
EmitType<Object>
Triggers when the component is destroyed.
EmitType<FocusEventArgs>
Triggers when the control gets focused.
Triggers while rendering the each popup list item.
Triggers when the popup is opened.