[ Close ] Learn more about our custom WordPress development services at htmlBurger

Documentation

Documentation > Fields > Time

Time

Renders a time picker field.

Field::make( 'time', 'opens_at', 'Opening time' )

Config methods

set_attribute( $name, $value = '' )

Sets a direct attribute of the resulting <input> field. Can only be one of the following: 'placeholder' and 'data-*'.

Field::make( 'time', 'crb_event_start', 'Event Start' )
    ->set_attribute( 'placeholder', 'Time of event start' );

set_storage_format( $storage_format )

Set the format which should be used to save date values in the database with. Defaults to H:i:s.

set_input_format( $php_format, $js_format )

Set the format which should be used to enter values in the administration. Note that you should specify the format in both PHP and JS variants (i.e. they should be translations of each other). The JS format used is Flatpickr’s.
Separating storage and input formats makes it possible for editors to use 12/31/2017 11:30 PM dates while the database stores 2017-12-31 23:30:00 behind the scenes.

set_picker_options( $options )

Set an associative array with your preferred options.

Excited about Carbon Fields? Spread the word!