Scheduled content not appearing because relevant date is not used

Created on 16 March 2023, almost 2 years ago

Problem/Motivation

Scheduled content using scheduler won't appear on the content_calendar.

Steps to reproduce

Create a node of the a content type enabled on the calendar and schedule it.

The node wont' appear on the calendar.

Proposed resolution

In order to map nodes to month days, formatSchedulingDateAsMySqlDateOnly method is used.

This method is nevertheless using the "created" node date:

  public function formatSchedulingDateAsMySqlDateOnly() {

    $datetime = DateTimeHelper::convertUnixTimestampToDatetime($this->getRelevantDate());

    return $datetime->format(DateTimeHelper::FORMAT_MYSQL_DATE_ONLY);
  }

It should use the getRelevantDate() method instead, as this ensures that the relevant date (created or publish_on) will be chosen:

  /**
   * Get the relevant date for the current node.
   *
   * When the Scheduler date is empty, then take the creation date.
   *
   * @return int
   *   Return published or created date.
   */
  public function getRelevantDate() {

    if ($this->node->publish_on) {
      return $this->node->publish_on;
    }

    return $this->node->created;
  }

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇪🇸Spain idiaz.roncero Madrid

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024