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 | Last Modified date is not rendered when it's the same as the the published date #53238

Closed
fabiankaegy opened this issue Aug 1, 2023 · 3 comments
Labels
[Block] Post Date Affects the Post Date Block [Type] Bug An existing feature does not function as intended

Comments

@fabiankaegy
Copy link
Member

Description

The Last Modified Date variant of the Post Date block does not render anything when the last updated date is the same as the published date.

https://github.com/WordPress/gutenberg/blob/c05c66c221ef3f5b43f094f229755adf3ef4515b/packages/block-library/src/post-date/index.php#L33C1-L45

This creates Layout issues because there is no way for the surrounding blocks to respond to whether or not the block will render anything.

In most cases where the last modified date is displayed, it needs additional context to showcase users what the date is actually displaying. So for example a paragraph before the block saying "Last Updated:"

However since the last modified block sometimes just doesn't render anything, this causes an issue where the text "Last Updated:" still displays. But the field itself just shows nothing.

CleanShot 2023-08-01 at 17 25 08@2x

Step-by-step reproduction instructions

  1. Create a new post
  2. Insert the Modified Date
  3. Save the post
  4. View it on the frontend
  5. See that the block is not actually rendered
  6. Change the published date of the post to be in the past by at least one day
  7. Visit the post on the frontend again
  8. See the updated date renders

Screenshots, screen recording, code snippet

No response

Environment info

  • WordPress 6.3 RC2
  • No Gutenberg Plugin

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@fabiankaegy fabiankaegy added [Type] Bug An existing feature does not function as intended [Block] Post Date Affects the Post Date Block labels Aug 1, 2023
@fabiankaegy
Copy link
Member Author

CC: @carolinan Just wanted to get your thoughts on this since I see you originally worked on the implementation for the Last Modified variation in #42312

@carolinan
Copy link
Contributor

carolinan commented Aug 1, 2023

I think that both blocks variations should have an editable prefix similar to some of the other blocks.

Showing the last modified date when it is the same as the published date would be a bug, since the purpose is to show when it is modified not published.

@fabiankaegy
Copy link
Member Author

I agree that a prefix & suffix would solve most use cases 👍

In that case I will close this in favor of #47738

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] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

2 participants