Skip to content

Commit

Permalink
Merge pull request #4240 from rdjuric/weekDayInLocalTime
Browse files Browse the repository at this point in the history
Show day of the week when other user is in a different date
  • Loading branch information
Clement DAL PALU authored Jul 27, 2021
2 parents b2582f3 + 4a539af commit d35ab90
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/pages/home/report/ParticipantLocalTime.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,14 @@ class ParticipantLocalTime extends React.Component {

getParticipantLocalTime() {
const reportRecipientTimezone = lodashGet(this.props.participant, 'timezone', {});
return moment().tz(reportRecipientTimezone.selected).format('LT');
}
const reportRecipientDay = moment().tz(reportRecipientTimezone.selected).format('dddd');
const currentUserDay = moment().tz(this.props.currentUserTimezone.selected).format('dddd');

if (reportRecipientDay !== currentUserDay) {
return `${moment().tz(reportRecipientTimezone.selected).format('LT')} ${reportRecipientDay}`;
}
return `${moment().tz(reportRecipientTimezone.selected).format('LT')}`;
}

render() {
// Moment.format does not return AM or PM values immediately.
Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/report/ReportActionCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ class ReportActionCompose extends React.Component {
]}
>
{shouldShowReportRecipientLocalTime
&& <ParticipantLocalTime participant={reportRecipient} />}
&& <ParticipantLocalTime participant={reportRecipient} currentUserTimezone={currentUserTimezone} />}
<View style={[
(this.state.isFocused || this.state.isDraggingOver)
? styles.chatItemComposeBoxFocusedColor
Expand Down

0 comments on commit d35ab90

Please sign in to comment.