We are using the form API in a custom module (and not an entity field), how can we easily set the date widget for just year and month data entry.
I've tried adding a #date_format attribute but no change.
$form['date_needed'] = array( '#type' => 'date', '#title' => $this->t('Date Needed'), '#date_date_format' => 'Y/m', );
I have also tried '#date_date_format' => 'd/m/Y' but the date widget still appears asking for YYYY-mm-dd.
Looking at the source code for core/Render/Element/Date.php and stepping though the code, I can see it's picking up this setting.
The drupal.org doc page has a comment that indicate this should work: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21Element%21Date.php/class/Date/8.2.x