Component

Date input field

The essentials of displaying form-item date-inputs.

By default we change the type of the input field from

<input type="date">

to 

<input type="text">

for cross-browser-consistency.

 

There is also a few variations of this component:

Defining a date input field

In the form definition you can create a date input field as follows:

$form['start_date'] = [
  '#type' => 'date',
  '#title' => $this->t('Start date'),
  '#date_date_format' => 'd/m/Y',
];
form-item--date
Drupal Core
Using Sass
Responsive
Accessible
HTML
CSS
Flat design
11 downloads
horizontal beam No open issue