Problem/Motivation
Some date formats in Drupal core are using the US format, for example the Default medium date for 7th of August:
Wed, 08/07/2024 - 11:24
Steps to reproduce
Open Administration > Configuration > Region and language > Date and time formats (/admin/config/regional/date-time) and see that US date format is used.
Proposed resolution
It would be nice to use a more international and human readable format, such as "7 Aug 2024". This is also used on drupal.org, as can be see in this issue, under "Created: 7 Aug 2024 at 11:24 CEST".
It is also the recommended format here:
- How to write the date correctly (IELTS)
- How to Write Dates Correctly in English (Grammarly)
- Overview of date formatting guidelines (Wikipedia)
Date formats currently
| Name | Pattern | |
|---|---|---|
| Default long date | Wednesday, August 7, 2024 - 13:55 | |
| Default medium date | Wed, 08/07/2024 - 13:55 | |
| Default short date | 08/07/2024 - 13:55 | |
| Olivero Medium | 7 August, 2024 | |
| Fallback date format | Wed, 08/07/2024 - 13:55 | |
| [...] |
Proposed changes to date formats
| Name | Pattern | |
|---|---|---|
| Default long date | Wednesday, 7 August 2024 - 13:55 | |
| Default medium date | Wed, 7 Aug 2024 - 13:55 | |
| Default short date | 7 Aug 2024 - 13:55 | |
| Olivero Medium | 7 August 2024 | |
| Fallback date format | Wed, 7 aug 2024 - 13:55 | |
| [...] |
Remaining tasks
Update the date formats to use an intuitively understandable and international standard:
Wednesday, 7 August 2024 - 13:55
User interface changes
New installs have more international-friendly date formats.
API changes
Data model changes
Translations
Issue fork drupal-3466529
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3466529-use-date-formats
changes, plain diff MR !9117
Comments
Comment #2
ressaComment #3
greggles+1 to using a more rapidly recognized date conceptually, though i notice that dates on admin/content are a similar format to security review.
Is there a reference page on drupal.org about formatting dates?
Comment #4
ressaThanks for a fast and positive reply @greggles.
Some of Drupal's date formats were actually set to use the ISO-8601 standard in 2004 (Drupal 4.5.0) by Dries, but they must have been lost somewhere along the way ...
Maybe we should update Drupal core instead, and then perhaps it will also fix Security Review's date format? It looks like it might be using a Drupal core date format:
I have updated the Issue Summary, and moved it to Drupal core instead.
Comment #5
ressaComment #6
ressaAnd about this:
I am not sure, but it would be great to have one, if only just stating that the date format in the ISO-8601 standard should be followed in Drupal.
Comment #8
ressaI tried updating the date formats and tests, maybe some more tests need to be updated? Let's see!
Comment #9
ressaActually, ISO 8601 doesn't cover month names (jan, feb, etc.) so this issue aims at switching to a rapidly recognizable date format, the same as drupal.org issues uses:
So updating the title.
Comment #10
smustgrave commentedWas wondering why this ticket looked familiar haha
Will agree with @greggles but MR appears to be failing a few tests.
Comment #11
ressaYes @smustgrave, I realized that the right method was to update all the dates :-)
And by the way, let me just repeat that I am eternally grateful that you started and lead the Needs Review Queue Initiative initiative. In my opinion, it's among the most important initiatives, together with Drupal Starshot.
Comment #12
ressaAdding "7th of August" in issue summary to clarify why "08/07/2024" can be opaque.
Comment #13
smustgrave commentedI appreciate that @ressa!
I checked the MR and changes make sense. Being from the US these formats made sense to me but agree that being more international is a good move.
Comment #14
catchThis looks great to me and a good sign that Olivero's visitor-facing format doesn't need to change. Could probably use product manager review though so tagging for that.
Comment #15
gábor hojtsyhttps://en.wikipedia.org/wiki/Wikipedia:Overview_of_date_formatting_guid... also lists this format as the first suggested although it does not seem to have hierarchy for formats. I think this is a good improvement, also this is what DrupalCon uses for their date formats. Removing product review tag as a core product manager.
Comment #16
ressaThanks for looking at this @catch and @Gábor Hojtsy.
I noticed that there is no comma in the recommended format on Wikipedia, and found few more sources with the same format. So I updated the MR, and removed the comma. I also updated the Olivero date format, which also had a few extra spaces.
Comment #17
ressaI have created the documentation page Date formats under "Coding standards", since I couldn't find a page dedicated to this subject ...
Perhaps someone can review it, and add it to the menu, or place it somewhere else, if it doesn't belong in that section? Thanks!
Comment #18
pameeela commentedBig +1 from me and agree with removing the comma as done in the latest change.
Comment #20
catchCommitted/pushed to 11.x, thanks!
Realised after commit that we didn't have a change record here, so added a quick one.
Comment #22
ressaThanks everyone for fast feedback and roll-out! It's impressive that this improvement went from idea to completion in less than a week, and already see it in effect in lists under "Content" and "Recent log messages", and node edit under "Last saved".
Comment #23
ressaI created a follow up issue #3467829: Use ISO 8601 format in Authored on field date picker.
Comment #24
ressa@greggles:
It doesn't look like there is, so I have created #3467914: Define a standard for Date formats.
Comment #25
smustgrave commentedAmazing work!
Comment #26
pfrenssenGreat improvement, and impressive speed of execution! Thanks all!
Comment #27
mstrelan commentedShould this have a change record or release note snippet?
EDIT: Sorry, there is a CR, but probably we should have something in User Interface Changes and Release Note Snippet
Comment #28
acbramley commentedThis is really funny but this change broke preview_link tests https://git.drupalcode.org/project/preview_link/-/jobs/2449886
Was fun to track down, thanks to @mstrelan for letting me know about this change!
Comment #29
longwaveAdded the UI changes section, don't think this needs a release note as it only affects new installs but tagged as a highlight in case we want to point it out in a blog post.
Comment #31
ressaI just created a related issue.