Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post Date Block: Offer relative date option #63325

Closed
cdils opened this issue Jul 9, 2024 · 3 comments
Closed

Post Date Block: Offer relative date option #63325

cdils opened this issue Jul 9, 2024 · 3 comments
Labels
[Block] Post Date Affects the Post Date Block [Type] Enhancement A suggestion for improvement.

Comments

@cdils
Copy link

cdils commented Jul 9, 2024

What problem does this address?

The Post Date block has a variety of date format options, including the option to enter a custom date format, but it would be nice to have the option to show the publish date as relative to the current date, something like:

Published x days ago

screen shot of wordpress post editor depicting a list view with the Date block selected and the corresponding block settings panel

This was a possible feature request noted a few times in #38751 by @kjellr, @ramonjd, and @jasmussen. As @mtias pointed out in #38751 (comment), that enhancement was out of scope for that ticket.

What is your proposed solution?

I'm not familiar enough with how the Date block works to know if this feature is in or out of scope for that block's intended use.

Currently, the Custom format only allows for a date/time format string and does not support free-form text, which makes total sense. But, if you wanted to display something like Published x days ago then that brings up some questions:

  1. Is the user allowed to append free-form text to the number of days since publishing? Adding custom text before and/or after the number of days seems like the most friendly approach for no or low code users. Though it would be nice to be able to programmatically filter that text.
  2. Any accompanying text strings, whether hard-coded or user-generated would need to account for singular/plural day/days, depending on context (e.g., 1 day ago, 2 days ago. And internationalization would need to be accounted for, of course.
  3. What would would you call it? Perhaps between the various date formats and the Custom option there's an option called Relative Date (see mock image)
image
@cdils cdils added the [Type] Enhancement A suggestion for improvement. label Jul 9, 2024
@t-hamano
Copy link
Contributor

Thanks for the suggestion.

Relative date format was already implemented in #62298, but this formatting is not part of WordPress 6.6, which will be released next week.

@t-hamano t-hamano closed this as not planned Won't fix, can't repro, duplicate, stale Jul 10, 2024
@t-hamano t-hamano added the [Block] Post Date Affects the Post Date Block label Jul 10, 2024
@jasmussen
Copy link
Contributor

Just seeing this typographic widow:
Screenshot 2024-07-10 at 08 34 26

Would be good to add text-wrap: balance; to this component.

@cdils
Copy link
Author

cdils commented Jul 10, 2024

Thanks for the suggestion.

Relative date format was already implemented in #62298, but this formatting is not part of WordPress 6.6, which will be released next week.

Thank you @t-hamano I'd missed #62259 as I'd made a rookie mistake and was searching for open issues. Excited to see this land in Core. 🙏🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Post Date Affects the Post Date Block [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

3 participants