Verified Commit baa0ed68 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3256549 by cilefen, murilohp, longwave, catch, Spokje: Deprecate...

Issue #3256549 by cilefen, murilohp, longwave, catch, Spokje: Deprecate core/drupal.date asset library in 9.4.0
parent e9294d88
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -502,6 +502,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: {}
+6 −0
Original line number Diff line number Diff line
@@ -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'])) {
+29 −0
Original line number Diff line number Diff line
<?php

namespace Drupal\Tests\Core\Render\Element;

use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Element\Date;
use Drupal\Tests\UnitTestCase;

/**
 * @coversDefaultClass \Drupal\Core\Render\Element\Date
 * @group Render
 */
class DateElementTest extends UnitTestCase {

  /**
   * @covers ::processDate
   * @group legacy
   */
  public function testProcessDate(): void {
    $element = [
      '#attributes' => ['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);
  }

}
+3 −0
Original line number Diff line number Diff line
@@ -139,6 +139,9 @@ public static function getSkippedDeprecations() {
      "The \"Drupal\Tests\Listeners\DrupalListener\" class implements \"PHPUnit\Framework\TestListener\" that is deprecated.",
      // Guzzle/PSR-7
      "Method \"Psr\Http\Message\StreamInterface::getMetadata()\" will return \"mixed\" as of its next major version. Doing the same in implementation \"GuzzleHttp\Psr7\Stream\" will be required when upgrading.",
      // Drupal date library deprecated.
      'The "core/drupal.date" 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',
      "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",
    ];
  }