Skip to content

Commit

Permalink
rename displayedTime vairables to make more sense
Browse files Browse the repository at this point in the history
  • Loading branch information
millerf committed Apr 27, 2020
1 parent 20c0305 commit 6157493
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions client/my-sites/post-relative-time-status/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ class PostRelativeTime extends React.PureComponent {
getDisplayedTimeForLabel( prefix = true ) {
const moment = this.props.moment;
const now = moment();
const scheduledDate = moment( this.getTimestamp() );
const timestamp = moment( this.getTimestamp() );

const isScheduledPost = this.props.post.status === 'future';

let scheduledTime;
let displayedTime;
if ( isScheduledPost ) {
scheduledTime = scheduledDate.calendar( null, {
displayedTime = timestamp.calendar( null, {
nextDay: this.props.translate( '[for tomorrow at] LT', {
comment: 'LT refers to time (eg. 18:00)',
} ),
Expand Down Expand Up @@ -85,15 +85,15 @@ class PostRelativeTime extends React.PureComponent {
} );
}

scheduledTime = scheduledDate.calendar( null, {
displayedTime = timestamp.calendar( null, {
sameElse: sameElseTranslation,
} );
}

// If the content is scheduled to be release within a year, do not display the year at the end
return scheduledDate.diff( now, 'years' ) > 0
? scheduledTime
: scheduledTime.replace( scheduledDate.format( 'Y' ), '' );
return timestamp.diff( now, 'years' ) > 0
? displayedTime
: displayedTime.replace( timestamp.format( 'Y' ), '' );
}

getTimeText() {
Expand Down Expand Up @@ -125,45 +125,45 @@ class PostRelativeTime extends React.PureComponent {
if ( status === 'trash' ) {
extraStatusClassName = 'is-trash';
statusIcon = 'trash';
const displayScheduleTime = this.getDisplayedTimeForLabel();
statusText = this.props.translate( 'trashed %(displayScheduleTime)s', {
comment: '%(displayScheduleTime)s is when a post or page was trashed',
const displayedTime = this.getDisplayedTimeForLabel();
statusText = this.props.translate( 'trashed %(displayedTime)s', {
comment: '%(displayedTime)s is when a post or page was trashed',
args: {
displayScheduleTime,
displayedTime,
},
} );
} else if ( status === 'future' ) {
extraStatusClassName = 'is-scheduled';
statusIcon = 'calendar';
const displayTime = this.getDisplayedTimeForLabel();
statusText = this.props.translate( 'scheduled %(displayScheduleTime)s', {
const displayedTime = this.getDisplayedTimeForLabel();
statusText = this.props.translate( 'scheduled %(displayedTime)s', {
comment: '%(displayTime)s is when a scheduled post or page is set to be published',
args: {
displayTime,
displayedTime,
},
} );
} else if ( status === 'draft' || status === 'pending' ) {
const displayScheduleTime = this.getDisplayedTimeForLabel();
statusText = this.props.translate( 'draft last modified %(displayScheduleTime)s', {
comment: '%(displayScheduleTime)s is when a draft post or page was last modified',
const displayTime = this.getDisplayedTimeForLabel();
statusText = this.props.translate( 'draft last modified %(displayTime)s', {
comment: '%(displayTime)s is when a draft post or page was last modified',
args: {
displayScheduleTime,
displayTime,
},
} );
} else if ( status === 'publish' ) {
const displayScheduleTime = this.getDisplayedTimeForLabel();
statusText = this.props.translate( 'published %(displayScheduleTime)s', {
comment: '%(displayScheduleTime)s is when a post or page was last modified',
const displayTime = this.getDisplayedTimeForLabel();
statusText = this.props.translate( 'published %(displayTime)s', {
comment: '%(displayTime)s is when a post or page was last modified',
args: {
displayScheduleTime,
displayTime,
},
} );
} else if ( status === 'private' ) {
const displayScheduleTime = this.getDisplayedTimeForLabel();
statusText = this.props.translate( 'private last modified %(displayScheduleTime)s', {
comment: '%(displayScheduleTime)s is when a private post or page was last modified',
const displayedTime = this.getDisplayedTimeForLabel();
statusText = this.props.translate( 'private last modified %(displayedTime)s', {
comment: '%(displayedTime)s is when a private post or page was last modified',
args: {
displayScheduleTime,
displayedTime,
},
} );
} else if ( status === 'new' ) {
Expand Down

0 comments on commit 6157493

Please sign in to comment.