Move DateTimeItem and DateRangeItem constants onto interfaces.

Created on 9 October 2017, about 7 years ago
Updated 9 April 2023, over 1 year ago

Problem/Motivation

DateTimeItem and DateRangeItem both have class constants. These should be on interfaces.

Proposed resolution

- Move the DateTimeItem constants onto DateTimeItemInterface as-is.

- Create DateRangeItemInterface, and move DateRangeItem constants as-is.

- Update usages to refer to the interface or static:: as appropriate.

Remaining tasks

User interface changes

API changes

Data model changes

๐Ÿ“Œ Task
Status

Needs work

Version

10.1 โœจ

Component
Datetimeย  โ†’

Last updated 6 days ago

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States mpdonadio Philadelphia/PA/USA (UTC-5)

Live updates comments and jobs are added and updated live.
  • Novice

    It would make a good project for someone who is new to the Drupal contribution process. It's preferred over Newbie.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Was tagged for change record updates. Maybe this needs it's own now.

  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia bhanu951

    Draft CR Created.

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Line core/modules/datetime/tests/src/Kernel/Views/DateTimeHandlerTestBase.php
    ------ ----------------------------------------------------------------------------------
    72 Access to an undefined static property
    static(Drupal\Tests\datetime\Kernel\Views\DateTimeHandlerTestBase)::$field_type.
    ------ ----------------------------------------------------------------------------------

    ------ -------------------------------------------------------------------------
    Line core/modules/datetime/tests/src/Kernel/Views/FilterDateTest.php
    ------ -------------------------------------------------------------------------
    53 Access to an undefined static property
    static(Drupal\Tests\datetime\Kernel\Views\FilterDateTest)::$field_name.
    ------ -------------------------------------------------------------------------

    ------ -------------------------------------------------------------------------------
    Line core/modules/datetime_range/tests/src/Kernel/Views/FilterDateTest.php
    ------ -------------------------------------------------------------------------------
    60 Access to an undefined static property
    static(Drupal\Tests\datetime_range\Kernel\Views\FilterDateTest)::$field_name.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sahil.goyal

    sahil.goyal โ†’ made their first commit to this issueโ€™s fork.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sahil.goyal

    Addressed the CCF error as described in #86.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia bhanu951

    @sahil.goyal changes to variable name format should be in other way around.

  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Moving to NW for failures in the MR.

  • Status changed to Needs review over 1 year ago
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Searching for DateTimeItem:: still see there are about 30+ instances remaining.

  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States rpayanm

    Please review.

  • Status changed to RTBC over 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Will let the committers decide but there are still some instances of DateTimeItem:: but they are in comments for some. Should these be updated too? Didn't think it was worth holding up the ticket.

      /**
       * Tests DateTimeItem::setValue().
       */
    
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia bhanu951
    grep -R --color "DateTimeItem::"
    ./core/modules/jsonapi/tests/src/Functional/JsonApiRegressionTest.php:      'settings' => ['datetime_type' => DateTimeItem::DATETIME_TYPE_DATETIME],
    ./core/modules/jsonapi/tests/src/Functional/JsonApiRegressionTest.php:      'settings' => ['datetime_type' => DateTimeItem::DATETIME_TYPE_DATE],
    ./core/modules/jsonapi/tests/src/Functional/JsonApiRegressionTest.php:      'settings' => ['datetime_type' => DateTimeItem::DATETIME_TYPE_DATETIME],
    ./core/modules/datetime_range/tests/src/Kernel/SeparatorTranslationTest.php:      'settings' => ['datetime_type' => DateTimeItem::DATETIME_TYPE_DATE],
    ./core/modules/datetime/tests/src/Functional/DateFilterTest.php:      'settings' => ['datetime_type' => DateTimeItem::DATETIME_TYPE_DATETIME],
    ./core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php:   * Tests DateTimeItem::setValue().
    ./core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php:    // Test DateTimeItem::setValue() using string.
    ./core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php:    $this->assertEquals($value, $entity->field_datetime[0]->value, 'DateTimeItem::setValue() works with string value.');
    ./core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php:    // Test DateTimeItem::setValue() using property array.
    ./core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php:    $this->assertEquals($value, $entity->field_datetime[0]->value, 'DateTimeItem::setValue() works with array value.');
    ./core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php:    // Test DateTimeItem::setValue() using string.
    ./core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php:    $this->assertEquals($value, $entity->field_datetime[0]->value, 'DateTimeItem::setValue() works with string value.');
    ./core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php:    // Test DateTimeItem::setValue() using property array.
    ./core/modules/datetime/tests/src/Kernel/DateTimeItemTest.php:    $this->assertEquals($value, $entity->field_datetime[0]->value, 'DateTimeItem::setValue() works with array value.');
    ./core/modules/datetime/src/Plugin/views/filter/Date.php:    if ($definition->getSetting('datetime_type') === DateTimeItem::DATETIME_TYPE_DATE) {
    ./core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php: * @see \Drupal\datetime\Plugin\Field\FieldType\DateTimeItem::DATETIME_TYPE_DATE
    ./core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php:    if ($parent_field_item_class === DateTimeItem::class) {
    ./core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php:    if ($parent_field_item_class === DateTimeItem::class) {
    ./core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php:      // @see \Drupal\datetime\Plugin\Field\FieldType\DateTimeItem:DATETIME_TYPE_DATE
    ./core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php:        DateTimeItem::class,
    ./core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php:        DateTimeItem::DATETIME_TYPE_DATE,
    ./core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php:      // @see \Drupal\datetime\Plugin\Field\FieldType\DateTimeItem:DATETIME_TYPE_DATETIME
    ./core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php:        DateTimeItem::class,
    ./core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php:        DateTimeItem::DATETIME_TYPE_DATETIME,
    ./core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php:    $field_definition->getSetting('datetime_type')->willReturn($type === 'date-only' ? DateTimeItem::DATETIME_TYPE_DATE : DateTimeItem::DATETIME_TYPE_DATETIME);
    ./core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php:    $field_definition->getSetting('datetime_type')->willReturn(DateTimeItem::DATETIME_TYPE_DATE);
    ./core/modules/serialization/tests/src/Unit/Normalizer/DateTimeIso8601NormalizerTest.php:    $field_definition->getSetting('datetime_type')->willReturn(DateTimeItem::DATETIME_TYPE_DATETIME);
    ./core/modules/serialization/src/Normalizer/DateTimeIso8601Normalizer.php:    if ($field_item instanceof DateTimeItem && $field_item->getFieldDefinition()->getFieldStorageDefinition()->getSetting('datetime_type') === DateTimeItem::DATETIME_TYPE_DATE) {
    ./core/modules/serialization/src/Normalizer/DateTimeIso8601Normalizer.php:    $is_date_only = $datetime_type === DateTimeItem::DATETIME_TYPE_DATE;
    
  • Assigned to bhanu951
  • Status changed to Needs work over 1 year ago
  • Issue was unassigned.
  • Status changed to Needs review over 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia bhanu951

    Please ignore Merge request !2321 ,

    Updated Merge request !3013 to replace existing few more instances of "DateTimeItem::"

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave
Production build 0.71.5 2024