- Issue created by @penyaskito
- 🇺🇸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.
- Merge request !239Update announcements date format in Drupal CMS dashboard → (Open) created by Unnamed author
- 🇪🇸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 intodrupal_cms_olivero/templates/
and editing the file, but the core template was still being used. - I went with
- 🇺🇸United States phenaproxima Massachusetts
Oh. My bad. Well, yeah, I guess if we need it for Gin, that complicates things.
- 🇪🇸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:
- 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.
- 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!