Skip to content

Conversation

@faisal-alvi
Copy link

Trac ticket: https://core.trac.wordpress.org/ticket/59381

This PR adds leading zeros when year has less than 4 digits.

Steps to Test

  1. With a block theme active, add an Archive block to a page template.
  2. Set permalinks to use "Month" based URL structure.
  3. Create or modify a post and set the post date to a year earlier than 1000, for example 420.
  4. Save and view/preview the post on the frontend.
  5. The Archive block's representation of the year should include leading zeros.
  6. The /420 archive listing page should work and does not show to a 404.

@faisal-alvi
Copy link
Author

This is ready for Code Review.

@ironprogrammer
Copy link
Member

Thanks for the patch, @faisal-alvi!

I wonder what consensus is on the frontend's display of years < 1000, versus how the slugs are formatted. For instance comparing:

  1. September 26, 520
  2. September 26, 0520

I prefer the first, without the leading zero. That's the English standard (e.g. Wikipedia's date guidelines), but I'm unsure for other languages/cultures. Rather than make a suggestion to change this at this time, I feel that additional contributor input would be valuable.

As for slugs, they're currently forced into YYYY format, so the update to the underlying anchor links in the archive list function how I'd expect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants