diff --git a/core/core.libraries.yml b/core/core.libraries.yml index 8951785cc6..2a2e5bc47a 100644 --- a/core/core.libraries.yml +++ b/core/core.libraries.yml @@ -471,6 +471,7 @@ drupal.customevent: misc/polyfills/customevent.js: { weight: -20 } drupal.date: + deprecated: The "%library_id%" asset library is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. There is no replacement. See https://www.drupal.org/node/3258267 version: VERSION js: misc/date.js: {} diff --git a/core/lib/Drupal/Core/Render/Element/Date.php b/core/lib/Drupal/Core/Render/Element/Date.php index 887f5d3905..86f6413c62 100644 --- a/core/lib/Drupal/Core/Render/Element/Date.php +++ b/core/lib/Drupal/Core/Render/Element/Date.php @@ -58,8 +58,14 @@ public function getInfo() { * * @return array * The processed element. + * + * @deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. There is + * no replacement. + * + * @see https://www.drupal.org/node/3258267 */ public static function processDate(&$element, FormStateInterface $form_state, &$complete_form) { + @trigger_error('Drupal\Core\Render\Element\Date::processDate() is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. There is no replacement. See https://www.drupal.org/node/3258267', E_USER_DEPRECATED); // Attach JS support for the date field, if we can determine which date // format should be used. if ($element['#attributes']['type'] == 'date' && !empty($element['#date_date_format'])) { diff --git a/core/tests/Drupal/Tests/Core/Render/Element/DateElementTest.php b/core/tests/Drupal/Tests/Core/Render/Element/DateElementTest.php new file mode 100644 index 0000000000..479f5428d3 --- /dev/null +++ b/core/tests/Drupal/Tests/Core/Render/Element/DateElementTest.php @@ -0,0 +1,29 @@ + ['type' => 'date'], + '#date_date_format' => 'Y-m-d', + ]; + $complete_form = []; + $this->expectDeprecation('Drupal\Core\Render\Element\Date::processDate() is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. There is no replacement. See https://www.drupal.org/node/3258267'); + Date::processDate($element, $this->createMock(FormStateInterface::class), $complete_form); + } + +}