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

Documentation

Documentation > Fields > Date

Date

Renders a date picker.

Field::make( 'date', 'crb_event_start_date', 'Start' )

Config methods

set_storage_format( $storage_format )

Set the format which should be used to save date values in the database with. Defaults to Y-m-d.

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!