From 6a1e37617247b26e0de6a0f62c588cd8c31ee128 Mon Sep 17 00:00:00 2001 From: Rodrigo Nascimento Date: Fri, 8 Dec 2017 09:24:37 -0200 Subject: [PATCH] =?UTF-8?q?[NEW]=20Better=20date=20format=20for=20room?= =?UTF-8?q?=E2=80=99s=20list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/presentation/RoomItem.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/presentation/RoomItem.js b/app/presentation/RoomItem.js index 3731dde1b..3105bd81a 100644 --- a/app/presentation/RoomItem.js +++ b/app/presentation/RoomItem.js @@ -110,6 +110,13 @@ export default class RoomItem extends React.PureComponent { ); } + formatDate = date => moment(date).calendar(null, { + lastDay: '[Yesterday]', + sameDay: 'HH:mm', + lastWeek: 'dddd', + sameElse: 'MMM D' + }) + renderNumber = (unread, userMentions) => { if (!unread || unread <= 0) { return; @@ -140,7 +147,7 @@ export default class RoomItem extends React.PureComponent { {this.icon} { name } - {_updatedAt ? { moment(_updatedAt).format(this.props.dateFormat) } : null} + {_updatedAt ? { this.formatDate(_updatedAt) } : null} {this.renderNumber(unread, userMentions)}