Skip to content

Commit

Permalink
Posts with publish status show the published date not the modified one (
Browse files Browse the repository at this point in the history
#64049)

Co-authored-by: oandregal <[email protected]>
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: jameskoster <[email protected]>
  • Loading branch information
4 people authored Jul 30, 2024
1 parent 0b54610 commit 55ddb6f
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions packages/edit-site/src/components/post-fields/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,19 +292,13 @@ function usePostFields( viewType ) {
);
}

// Pending & Published posts show the modified date if it's newer.
const dateToDisplay =
getDate( item.modified ) > getDate( item.date )
? item.modified
: item.date;

const isPending = item.status === 'pending';
if ( isPending ) {
const isPublished = item.status === 'publish';
if ( isPublished ) {
return createInterpolateElement(
sprintf(
/* translators: %s: the newest of created or modified date for the page */
__( '<span>Modified: <time>%s</time></span>' ),
getFormattedDate( dateToDisplay )
/* translators: %s: page creation time */
__( '<span>Published: <time>%s</time></span>' ),
getFormattedDate( item.date )
),
{
span: <span />,
Expand All @@ -313,12 +307,18 @@ function usePostFields( viewType ) {
);
}

const isPublished = item.status === 'publish';
if ( isPublished ) {
// Pending posts show the modified date if it's newer.
const dateToDisplay =
getDate( item.modified ) > getDate( item.date )
? item.modified
: item.date;

const isPending = item.status === 'pending';
if ( isPending ) {
return createInterpolateElement(
sprintf(
/* translators: %s: the newest of created or modified date for the page */
__( '<span>Published: <time>%s</time></span>' ),
__( '<span>Modified: <time>%s</time></span>' ),
getFormattedDate( dateToDisplay )
),
{
Expand Down

0 comments on commit 55ddb6f

Please sign in to comment.