Adding ajax to a date field Anything I could find related to this question was for Drupal 7.

I am building a form that needs to perform a certain ajax function when a date is selected. I have built my form to work similarly to the "Form API Examples - Ajax Form Example" part of the Examples module.

To test, I set it up so that, like in the example, when this Select element is changed it triggers the function "dateCallback":

$form['dropdown'] = [
    '#title' =&gt; $this-&gt;t('Test'),
    '#type' =&gt; 'select',
    '#options' =&gt; ['option1' =&gt; '1', 'option2' =&gt; '2'],
    '#ajax' =&gt; [
        'callback' =&gt; '::dateCallback',
        'wrapper' =&gt; 'log-wrapper',
    ],
];


This executes perfectly.

However, when I try to set up a Date element to do the same function, nothing happens. No Ajax spinner, just nothing happens at all.

$form['date'] = array(
    '#type' =&gt; 'date',
    '#title' =&gt; t('Date'),
    '#ajax' =&gt; [
        'callback' =&gt; '::dateCallback',
        'wrapper' =&gt; 'log-wrapper',
    ],
);


It does not work even if I include 'event' =&gt; 'onchange' in the #ajax array.

Is it possible to make ajax functions trigger on a changed date field?
After some more searching I found a patch for this issue here: https://www.drupal.org/node/2781103

Seems to be working for me in Drupal 8.2.6. I did have to restart apache before it started to work, maybe a cache clear was all I needed for it though.

Not sure if I should accept this answer since it may become quickly outdated.