-
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
Clarify date
value in Pages
#61709
Clarify date
value in Pages
#61709
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. |
date
date is displayed in Pagesdate
value in Pages
Size Change: +239 B (+0.01%) Total Size: 1.75 MB
ℹ️ View Unchanged
|
? item.modified | ||
: item.date; | ||
return ( | ||
<> |
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.
I think we need to use createInterpolateElement
in these cases.. cc @mcsf
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 for bringing it up. I was looking into that but had issues with collapsed whitespace, note how the Scheduled:May
here:
It turns out it wasn't the interpolation but a CSS rule (display: flex
) of the dataviews-view-table__cell-content-wrapper
. I just figured the text node was considered a different node and its whitespace collapsed, so I added a span
wrapper for the text node & the time to be considered a single element by its flex container.
const formattedDate = dateI18n( | ||
getSettings().formats.datetimeAbbreviated, | ||
getDate( item.date ) | ||
const isDraftOrPrivate = [ 'draft', 'private' ].some( |
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.
Nit: we could just use Array.includes
here. Also no need to have it as a variable.
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, this looks good! I think we will probably just need to use createInterpolateElement
and it would be good to land.
if ( isPublished ) { | ||
const isModified = | ||
getDate( item.modified ) > getDate( item.modified ); | ||
const dateToDisplay = isModified |
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.
Nit: I guess we could reuse the code to check if is modified. I don't think we care about the order of checks here, since we check against explicit post statuses, so the modified check could be grouped together..
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.
Organized the code a bit differently, so it's clear with post statuses differentiate between modified/creation date and which ones do not.
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, thanks!
Co-authored-by: oandregal <[email protected]> Co-authored-by: ntsekouras <[email protected]> Co-authored-by: jasmussen <[email protected]> Co-authored-by: jameskoster <[email protected]>
I have a follow-up #64049 The Published posts need to use the published date, not the modified one. |
Fixes #60477
What?
Enhances the information displayed in the
date
field.Why?
We aim to get parity with wp-admin:
Target design for dataviews:
How?
Adds logic to the
date
field rendering depending on the post status:item.date
) or modified (item.modified
).item.date
) date, which is in the future.item.date
), even if it has been modified.item.date
) or modified (item.modified
).Testing Instructions