Skip to main content

Time

Generate a text input field which will show a time picker overlay when focused.

Basic usage

{{
form.time({
'label': 'Start time',
'id': 'guid-' ~ random(),
'name': 'time-1'
})
}}

Helper options

You can configure this helper using the common helper options. The following options are specific to this helper.

OptionTypeDescription
data-appendTostringOverride where the dropdown is appended (default body)
data-classNamestringA class to apply to the input that has the timepicker dropdown
data-closeOnWindowScrollbooleanClose the timepicker when the window is scrolled (default false)
data-disableTimeRangesarrayDisable selection of certain time ranges by passing an array of time pairs, for example [['3:00am', '4:30am'], ['5:00pm', '8:00pm']] The start of the interval will be disabled but the end won’t
data-disableTextInputbooleanDisable the ability to type in the input box, forcing users to select from the list. (default false)
data-maxTimestringThe time that should appear last in the dropdown list. Can be used to limit the range of time options
data-minTimestringThe time that should appear first in the dropdown list
data-orientationstring

By default the timepicker will be aligned to the bottom left of the input element, or aligned to the top left if there isn’t enough room below the input. Values can be:

  • l (left (default))
  • r (right)
  • t (top)
  • b (bottom)
Combine letters to move to corners, e.g. tr for top-right
data-timeFormatstringHow times should be displayed in the list and input element. Uses PHP’s date() formatting syntax. Characters can be escaped with a preceeding double shash (e.g. H\\hi) (Default: g:ia)