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.

Specifications

Machine name

form-item--date

Built upon

Drupal Core

Perks

Using Sass
Responsive
Using Drupal behaviours

Drawbacks

Uses jQuery
Not accessible

Building blocks

HTML
CSS
Javascript

Inspired by

Flat design

Stats

Public component
17 downloads
No open issue

Contributors