fix message search date

This commit is contained in:
Salvatore Giordano
2020-12-18 15:54:13 +01:00
parent e3b268fb45
commit 74781fd24f
+6 -6
View File
@@ -77,16 +77,16 @@ class MessageSearchItem extends StatelessWidget {
} }
Widget _buildDate(BuildContext context, Message message) { Widget _buildDate(BuildContext context, Message message) {
final lastUpdatedAt = message.updatedAt; final createdAt = message.createdAt;
String stringDate; String stringDate;
final now = DateTime.now(); final now = DateTime.now();
if (now.year != lastUpdatedAt.year || if (now.year != createdAt.year ||
now.month != lastUpdatedAt.month || now.month != createdAt.month ||
now.day != lastUpdatedAt.day) { now.day != createdAt.day) {
stringDate = Jiffy(lastUpdatedAt.toLocal()).format('dd/MM/yyyy'); stringDate = Jiffy(createdAt.toLocal()).format('dd/MM/yyyy');
} else { } else {
stringDate = Jiffy(lastUpdatedAt.toLocal()).format('HH:mm'); stringDate = Jiffy(createdAt.toLocal()).format('HH:mm');
} }
return Text( return Text(