-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Refactor Post Date Relative Time Rendering for Future Dates #62979
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to update the Comment Date block as well?
I don't think so, as this case is only for when a post is scheduled for future date. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
By the way, I noticed a while ago that when the time is displayed in minutes, the editor displays it as "minute/minutes", but the front end uses the abbreviation (min/mins). This is because the human_time_diff()
function uses an abbreviation only for "minutes". This issue was addressed by the following core ticket:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again @amitraj2203
…es (WordPress#62979) Co-authored-by: amitraj2203 <[email protected]> Co-authored-by: noisysocks <[email protected]> Co-authored-by: t-hamano <[email protected]> Co-authored-by: mrfoxtalbot <[email protected]>
What?
Fixes: #62976
Why?
When you have a Date block on a post, schedule the post to the future, and then preview the post, the Date block shows a past date, even though the editor showed a relative future-tense date.
How?
This PR modifies the post date block's relative time format rendering logic to correctly display future dates using
%s from now
format alongside existing%s ago
handling.Testing Instructions
Screenshots or screencast
Screen.Recording.2024-06-28.at.7.55.55.PM.mov