Announcements date format in Drupal CMS Dashboard

Created on 26 November 2024, 26 days ago

Problem/Motivation

Drupal CMS designs include a different date format in the announcements block than the provided core block.

Core: "short" format 14 Oct 2024 - 18:49
Designs use a short date format: May 23, 2024.

There's no date_format right now with that format. The date-format is specified in the announcements_feed/templates/announcements.html.twig template

Steps to reproduce

Check dashboard after drupal cms installation.

Proposed resolution

We have several alternatives.

1. Do nothing. Design driven by code and not the opposite. They'll hate me.
2. Fix in core by changing the template and provided date formats?
3. Fix in gin by changing the template? It might require a date format that doesn't exist, but we could also hardcode in template.
4. Fix in dashboard? Feels out of scope, but feasible. It might require a date format that doesn't exist, but we could also hardcode in template.
5. Should we change the existing date format in Drupal CMS? TBH this sounds like the most reasonable solution, but will affect other places. We lacked a Drupal Design system, now we need to apply it consistently :)

Remaining tasks

Decide on alternatives.

User interface changes

Date format on announcement block.

API changes

TBD

Data model changes

TBD

📌 Task
Status

Active

Component

Track: Dashboard

Created by

🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

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

Merge Requests

Comments & Activities

  • Issue created by @penyaskito
  • 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺
  • 🇺🇸United States phenaproxima Massachusetts

    You didn't ask for my opinion, but like a cat delivering a dead mouse to your door, I'm giving it to you anyway: screw doing this the "right" way. We have a subtheme of Olivero that we control, and we control the recipes. I say ship the date format with the subtheme and have it use that.

  • 🇸🇰Slovakia poker10

    There was a word hardcode - I suggest that we do not hardcode any date strings into the template. Otherwise the sites will loose the ability to customize the output based on local habits. Agree with @phenaproxima, that if needed, a better idea seems to be to create a new format and change the format in Olivero subtheme.

  • First commit to issue fork.
  • Pipeline finished with Canceled
    26 days ago
    Total: 160s
    #350987
  • 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

    @phenaproxima I didn't summon you because I take it for granted, my bad. We control the Olivero subtheme, but we don't have a Gin subtheme. We should be fine providing the _new_ date format in drupal_cms_starter or editing an existing one. But we still need to override the template in Gin or a potential Gin subtheme.

    @poker10 Those are the options I could think of. Not saying that all of them are good, and yes, hardcoding will break localization so I hope we aren't forced that path.

  • 🇳🇮Nicaragua dinarcon

    Testing the waters of contributing to Drupal CMS... :-)

    Some things that might to be updated:

    • I went with compact for the new text format. Is this good?
    • The example date is May 23, 2024. Shall we use the full textual representation (F) or the short, three letters one (M)?
    • As for the day, shall we use leading zeroes (m) or not (n).

    My expectation that providing drupal_cms_olivero/templates/announcements.html.twig would overwridde the template, but it did not. Turned on Twig debugging and saw this:

    <!-- THEME DEBUG -->
    <!-- THEME HOOK: 'announcements_feed' -->
    <!-- BEGIN OUTPUT from 'core/modules/announcements_feed/templates/announcements-feed.html.twig' -->
      <nav class="announcements">
        <ul>
                        <li class="announcement announcement--standard">
              <div class="announcement__title">
                <a href="https://www.drupal.org/about/announcements/blog/drupalcon-singapore-2024-what-awaits-you-in-the-lion-city">DrupalCon Singapore 2024: What Awaits You in the Lion City</a>
                <div class="announcement__date">14 Oct 2024 - 11:49</div>
              </div>
            </li>
                  <li class="announcement announcement--standard">
              <div class="announcement__title">
                <a href="https://www.drupal.org/blog/drupal-11-released">Drupal 11 released</a>
                <div class="announcement__date">1 Aug 2024 - 17:57</div>
              </div>
            </li>
              </ul>
      </nav>
    
          <p class="announcements--view-all">
          <a target="_blank" href="https://www.drupal.org/about/announcements">View all announcements</a>
        </p>
      
    <!-- END OUTPUT from 'core/modules/announcements_feed/templates/announcements-feed.html.twig' -->

    Looking at core/modules/announcements_feed/templates/announcements-feed.html.twig I see:

    {% include '@announcements_feed/announcements.html.twig' %}

    Tried to overwrite announcements-feed.html.twig, copying into drupal_cms_olivero/templates/ and editing the file, but the core template was still being used.

  • 🇺🇸United States phenaproxima Massachusetts

    Oh. My bad. Well, yeah, I guess if we need it for Gin, that complicates things.

  • Pipeline finished with Success
    26 days ago
    Total: 1211s
    #350989
  • Pipeline finished with Success
    26 days ago
    Total: 1253s
    #350990
  • 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

    @dinarcon Month format: short (M). E.g Jan. I picked the worse possible example from the design lol. Day format: no leading (n) IMHO, but the design examples don't specify. I'd wait for some agreement before moving to creating an MR.

  • 🇦🇺Australia pameeela

    Should we change the existing date format in Drupal CMS? TBH this sounds like the most reasonable solution, but will affect other places.

    Definitely not, this format is used in the content view and we want the time specified there. I can understand why the designs dropped the time from this because it's not super relevant but "May 23, 2024" is a U.S. date format that we should never use by default.

    My suggestion would be that we don't touch it in Drupal CMS but make an issue to update it in the Announcements feed to drop the time. But the format should remain as DD Month YYYY.

  • 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

    We don't have such a date provided by system module, which is the only dependency Announcements module has. I understand their decision here based on the constraints.

    So we would need to

    a) Provide a new date format in Announcements module and use it. Cons: Confusing, maybe repetitive?
    b) The theme is responsible here as the design system owner. An existing usecase is the existing "Olivero Medium" date format in core... but Olivero doesn't override the template.

    So IMHO this is actually two issues:

    1. Olivero should override the template for using the "Olivero Medium" date format.
    2. Gin should provide a "Gin Short Date" date format, and override the template for using this new date format.

    Thoughts?

  • 🇦🇺Australia pameeela

    Sorry, I see what you mean now. But still, I feel this is a core thing? There are two key points for me:

    1. Drupal CMS should ideally use the same date formats as core by default. If sites want to override them that's fine but I can't see a reason to override core, at this point.
    2. The Announcements feed really doesn't need to show the time, so this change could be made in core. If core doesn't agree, I still don't think this is a reason to override core? But we could if we really wanted to.
  • 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

    OK, then created 📌 Update announcements date format Active . Thanks!

  • 🇦🇺Australia pameeela

    Amazing, thank you! I will mark this won't fix for now.

Production build 0.71.5 2024