TimeField
The time field widget is a text input field with a time picker drop down. It shows left/right arrows to increase or decrease time by the step value.
This field can be used as an editor for the Column. It is used as the default editor for the TimeColumn.
Configuring forward / backward step size
The step configuration controls how the time value changes when using the forward and backward buttons at the start and end of the field. The step value is also used to configure the appropriate picker:
- For steps in minutes (e.g. '5m'), the minute picker will use this step value
- For steps in hours (e.g. '2h'), the hour picker will use this step value
new TimeField({
label : 'Time field',
appendTo : document.body,
step : '5 minutes' // Controls both field buttons and minute picker
});
This widget may be operated using the keyboard. ArrowDown opens the time picker, which itself
is keyboard navigable. Shift+ArrowDown activates the step back trigger.
Shift+ArrowUp activates the step forwards trigger.
let field = new TimeField({
format: 'HH'
});
//<code-header>
fiddle.title = 'Time field';
//</code-header>
new TimeField({
labelPosition : 'above',
label : 'Not editable',
editable : false,
style : 'margin-right: .5em',
appendTo : targetElement
});
new TimeField({
labelPosition : 'above',
label : 'Editable',
editable : true,
appendTo : targetElement,
value : new Date(2024, 0, 1),
step : '5 minutes'
});Configs
120
Configs
120Other
Format for date displayed in field (see Core.helper.DateHelper#function-format-static for formatting options).
Set to true to not clean up the date part of the passed value. Set to false to reset the date part to January 1st
Max time value
Min time value
A reference to a partner DateField which this TimeField should sync its value with. When the DateField's value is changed, this TimeField's value is updated to match. When this TimeField's value is changed, the DateField's value is updated to match.
When a string is passed, this is taken to be the widget's reference
property and the actual DateField is looked up in the same owner
container as this TimeField. If the reference cannot be found there, the string is used as a widget id.
Time increment duration value. Defaults to 5 minutes.
The value is taken to be a string consisting of the numeric magnitude and the units.
The units may be a recognised unit abbreviation of this locale or the full local unit name.
For example "10m" or "5min" or "2 hours"
Set to false to hide the forward and backward time step triggers.
Widgets that trigger functionality upon click. Each trigger icon is a Widget instance which may be hidden, shown and observed and styled just like any other widget.
| Parameter | Type | Description |
|---|---|---|
triggers.expand | FieldTriggerConfig | Expands the picker to select a time |
triggers.back | FieldTriggerConfig | Subtracts the step from the current time |
triggers.forward | FieldTriggerConfig | Adds the step to the current time |
triggers.clear | FieldTriggerConfig | Clears the field value, only available if this field is clearable |
DOM
Float & align
Input element
Label
Layout
Misc
Scrolling
Properties
94
Properties
94Class hierarchy
Other
Get/Set format for time displayed in field (see format for formatting options).
Set to true to not clean up the date part of the passed value. Set to false to reset the date part to January 1st
Get/set max value, which can be a Date or a string. If a string is specified, it will be converted using the specified format.
Get/set min value, which can be a Date or a string. If a string is specified, it will be converted using the specified format.
A reference to a partner DateField which this TimeField should sync its value with. When the DateField's value is changed, this TimeField's value is updated to match. When this TimeField's value is changed, the DateField's value is updated to match.
When a string is passed, this is taken to be the widget's reference
property and the actual DateField is looked up in the same owner
container as this TimeField. If the reference cannot be found there, the string is used as a widget id.
The step property may be set in Object form specifying two properties, magnitude, a Number, and
unit, a String.
If a Number is passed, the steps's current unit is used and just the magnitude is changed.
If a String is passed, it is parsed by parseDuration, for
example '5m', '5 m', '5 min', '5 minutes'.
Upon read, the value is always returned in object form containing magnitude and unit.
Widgets that trigger functionality upon click. Each trigger icon is a Widget instance which may be hidden, shown and observed and styled just like any other widget.
| Parameter | Type | Description |
|---|---|---|
triggers.expand | FieldTriggerConfig | Expands the picker to select a time |
triggers.back | FieldTriggerConfig | Subtracts the step from the current time |
triggers.forward | FieldTriggerConfig | Adds the step to the current time |
triggers.clear | FieldTriggerConfig | Clears the field value, only available if this field is clearable |
CSS
DOM
Layout
Misc
Picker
Functions
67
Functions
67Other
Show picker