Date input field

The essentials of displaying form-item date-inputs.

For cross-browser-consistency this component changes the type of the input field from

<input type="date">

to 

<input type="text">

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',
];

Specifications

Machine name

form-item--date

Built upon

Drupal Core

Perks

Using Sass
Responsive
Accessible

Building blocks

HTML
CSS

Inspired by

Flat design

Stats

Public component
31 downloads
No open issue

Contributors