diff --git a/src/Element/WebformMetadataDate.php b/src/Element/WebformMetadataDate.php index 9e71d47..07954aa 100644 --- a/src/Element/WebformMetadataDate.php +++ b/src/Element/WebformMetadataDate.php @@ -254,6 +254,13 @@ public static function processWebformMetadataDate(&$element, FormStateInterface $element['date_from']['#datepicker'] = TRUE; $element['date_to']['#datepicker'] = TRUE; + // @see https://www.drupal.org/node/3258267 + // Basically the preRender callback that should fix this is called AFTER the + // \Drupal\Core\Render\Element\Date::processDate. + // So stupid. No where people check if an array key exists before using it + // NOWHERE!! + $element['date_from']['#attributes']['type'] = 'date'; + $element['date_to']['#attributes']['type'] = 'date'; $element['date_free']['#title'] = $date_free_title; $element['date_free']['#attributes']['class'][] = 'webform-date-free'; diff --git a/src/Plugin/WebformElement/WebformMetadataDate.php b/src/Plugin/WebformElement/WebformMetadataDate.php index e721521..fa5bb6e 100644 --- a/src/Plugin/WebformElement/WebformMetadataDate.php +++ b/src/Plugin/WebformElement/WebformMetadataDate.php @@ -99,9 +99,9 @@ public function prepare( // Convert date element into textfield with date picker. if (!empty($element['#datepicker'])) { $element['#attributes']['type'] = 'text'; - // Must manually set 'data-drupal-date-format' to trigger date picker. // @see \Drupal\Core\Render\Element\Date::processDate + $element['#attributes']['data-drupal-date-format'] = [$element['#date_date_format']]; }