Promo card should display 'Authored on' date for date display

Created on 19 January 2024, 11 months ago

When a Promo card is used in a list, the ‘Last saved’ Publish date of the referenced node displays on the card. This needs to be updated to display the date from ‘Authoring information’. The reason being, this card is often used to promote ‘news’ type pages in a list, if the date is updated every time the referenced node is edited the date of the news will be misleading.

This, or, we need a specific date override.

Acceptance Criteria

Given I’m an authenticated user
When I view the date on the Promo card when used in a list
Then it matches the date in the referenced node’s Authored on field
When I manually change the date in the Authored on field
Then the new date is displayed on the Promo card

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇦🇺Australia alex.skrypnyk Melbourne

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

Comments & Activities

  • Issue created by @alex.skrypnyk
  • Assigned to fionamorrison23
  • Status changed to Postponed: needs info 9 months ago
  • 🇦🇺Australia alex.skrypnyk Melbourne

    @fionamorrison23
    Promo card is one of the teaser display modes for a content type. So the logic could potentially apply to other content types shown as different cards etc.

    I suggest introducing a per-content type setting in the theme settings (similar to what we have for components) to let the site owner to choose what date is shown in teasers for what content type. These settings will also per-content type settings for other properties specified in other tickets (for example - per-content type node Light or Dark theme).

    Once introduced, it will be up to the site owner to choose how this is displayed.

  • Status changed to Active 6 months ago
  • 🇦🇺Australia sime Melbourne

    I'm not sure if the date should be selectable but it definitely shouldn't use the "changed date" for promo cards, it should use the date created.

  • 🇦🇺Australia sime Melbourne

    This is all really the job of entity bundle classes, but fwiw i've changed the theme to do this to get the created time.

    I needed to add (int) because getCreatedTime() returns timestamp as a string.

      * Pre-process for Date node field.
      */
     function _civictheme_preprocess_paragraph__node_field__date(array &$variables): void {
       if ($node) {
    -    $variables['date'] = civictheme_format_datetime($node->getChangedTime(), 'civictheme_short_date');
    -    $variables['date_iso'] = civictheme_format_datetime_iso($node->getChangedTime());
    +    $variables['date'] = civictheme_format_datetime((int) $node->getCreatedTime(), 'civictheme_short_date');
    +    $variables['date_iso'] = civictheme_format_datetime_iso((int) $node->getCreatedTime());
       }
     }
    
  • 🇦🇺Australia alex.skrypnyk Melbourne

    @sime
    Every site owner have their own opinion about what timestamp should be used in what type of a card.
    Currently, there are 3 for `Page`:
    - Created date
    - Updated date
    - Manually set Last Updated date

    This issue is about implementing such flexible configuration.

  • 🇦🇺Australia sime Melbourne

    I can't speak for the extra data fields, I would love to hear an example of using the updated date on a card (which is the default being used here) - it's always interesting to learn about different requirements.

  • I've just come across this issue again. I made an update to a node where I have set a custom last updated date. I want that date to remain custom as the page has content that is important to know when the content was published. This page is referenced in an Automated list on a promo card. It now shows today's date in the promo card, but I want it to reference the custom last updated date from the referenced node.

    Would there ever be a case where a promo card and the node it references needs to have a different date? Unlikely.
    To me, it makes sense for the promo card (and any other cards that show a referenced date) to reference the Custom last updated date. That way the user has total control over the date on the node and the cards.

    Thoughts @sime @alex.skrypnyk @richardgaunt?

  • 🇦🇺Australia alex.skrypnyk Melbourne

    The Custom date is an override. If it is not selected by the user, a published or updated date should be used instead.

    Promo or any other cards/snippets/etc are just the ways to display the referenced content. IMO, the logic should be consistent across all components, but configurable per content type.

    So, for "News", for example, a site owner may chose "Updated date" (and Custom date would override it if set by the user)
    But, for "Events", for example, a site owner may chose "Created date" (and Custom date would override it if set by the user)

Production build 0.71.5 2024