Component

Date input field with datepicker and select2

This is an alternate version of form-item--date.  that uses both jQuery UI Datepicker and the Select2 library.

This component relies on the Select with Select2 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',
];

 

Warning
This component doesn't work for logged-in users when the quick-edit module is enabled, because of conflicting JS.

form-item--date
Drupal Core
Using Sass
Responsive
Using Drupal behaviours
Uses jQuery
Not accessible
HTML
CSS
Javascript
Flat design
3 downloads
horizontal beam No open issue