Make WordPress Core

Opened 3 years ago

Closed 2 months ago

Last modified 2 months ago

#55685 closed enhancement (fixed)

Date setting should have two more options: j.n.Y and d.m.Y

Reported by: daedalon's profile Daedalon Owned by: pbearne's profile pbearne
Milestone: 6.8 Priority: normal
Severity: normal Version: 5.9.3
Component: Date/Time Keywords: has-patch
Focuses: ui, administration Cc:

Description

Everytime I set up a WordPress site, I have to consult the PHP date formatting rules to get the site to show dates in the way that is standard in much of Europe, Post-Soviet countries, and many other places: j.n.Y. That is, 31.12.2022 for the last day of this year, or 5.5.2022 for today, with no leading zeroes.

This is a shortened way of the official d.m.Y, which shows 05.05.2022 for today, with leading zeroes. Most of the time I see all types of organizations and individuals prefer the shorter version without leading zeroes, but this official notation has plenty of users as well.

Both would be so helpful for so many users to have as one-click options in the site's General Settings page that I think it'd be great to add them there.

More info

https://en.wikipedia.org/wiki/Date_and_time_notation_in_Europe

https://en.wikipedia.org/wiki/Date_format_by_country

Searching the latter page for "d.m" finds 36 countries where either of these formats is in widespread usage. The combined population of these countries is approx. a billion people (e.g. Russia, Germany, Ukraine, Turkey, Israel, Poland). In addition to these, the list shows approx. 100 countries following the DMY order of date representation, without specifying the separators (dots "." or otherwise). The combined population in countries using j.n.Y or d.m.Y representations of dates might be well in excess of 1 billion people.

Change History (7)

#1 @fierevere
3 years ago

Localized WordPress (when you select language at installation) will use locale time representation.

So d.m.Y for russian for example

#2 @SergeyBiryukov
3 years ago

  • Component changed from General to Date/Time

Hi there, thanks for the ticket!

As noted above, one of the date format options is translatable, so localized WordPress packages can (and already do) add their own preferred date format by translating the __( 'F j, Y' ) string, for example, to d.m.Y.

That said, given its widespread usage, I think d.m.Y would beneft from being added as separate option, so that one could choose it regardless of the current user's locale or the admin locale. It would then be displayed and recognized as one of the officially supported options, instead of "Custom".

I'm less sure about j.n.Y. In the latest quarter of the year, a date like 10.11.2022 would be the same in both formats, so it might be hard to tell the difference from d.m.Y. The was also a concern voiced previously in comment:5:ticket:28447 about adding too many options. Other than that, I don't have any strong objections.

Slightly related: #48239

This ticket was mentioned in PR #7891 on WordPress/wordpress-develop by @pbearne.


3 months ago
#3

  • Keywords has-patch added

… WordPress's general settings. This gives users another option when selecting how dates are displayed on their site. The array_unique call ensures that if this format was already added by a plugin or theme, it won't be duplicated. This change is relevant if you are concerned with internationalization or providing more date format choices for users in regions where this format is common.

#4 @pbearne
3 months ago

  • Milestone changed from Awaiting Review to 6.8
  • Owner set to pbearne
  • Status changed from new to assigned

This is an easy add so let's do it

@SergeyBiryukov can you add it?

#5 @im3dabasia1
3 months ago

Test Report

Description

This report validates whether the indicated patch works as expected.

Patch tested: https://github.com/WordPress/wordpress-develop/pull/7891.diff

Environment

  • WordPress: 6.8-alpha-59274-src
  • PHP: 8.2.25
  • Server: nginx/1.27.2
  • Database: mysqli (Server: 8.0.40 / Client: mysqlnd 8.2.25)
  • Browser: Chrome 129.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.0
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.0

Actual Results

  1. ✅ Issue resolved with patch. The date format ‘d.m.Y’ is now added in the date formats in the Settings > General

Supplemental Artifacts

https://i.postimg.cc/XYjBJx7m/Screenshot-2024-11-26-at-1-10-45-PM.png

#6 @SergeyBiryukov
2 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 59475:

Date/Time: Add d.m.Y to date format presets on General Settings screen.

This gives users another option when selecting how dates are displayed on their site. This change is relevant for better localization, providing more date format choices for users in regions where this format is common.

The array_unique() call ensures that if this format was already added by a plugin or theme, it won't be duplicated.

Follow-up to [9131], [22299], [28820], [28848].

Props Daedalon, pbearne, fierevere, im3dabasia1, SergeyBiryukov.
Fixes #55685.

@SergeyBiryukov commented on PR #7891:


2 months ago
#7

Thanks for the PR! Merged in r59475.

Note: See TracTickets for help on using tickets.