Skip to content

Commit

Permalink
fix message divider for week and years
Browse files Browse the repository at this point in the history
  • Loading branch information
imtoori committed Apr 21, 2020
1 parent 0b039bf commit 4957619
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/src/message_list_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,18 @@ class _MessageListViewState extends State<MessageListView> {
} else if (Jiffy(createdAt)
.isSame(now.subtract(Duration(days: 1)), Units.DAY)) {
dayInfo = 'YESTERDAY';
} else {
} else if (Jiffy(createdAt).isAfter(
now.subtract(Duration(days: 7)),
Units.DAY,
)) {
dayInfo = createdAt.format('EEEE').toUpperCase();
} else if (Jiffy(createdAt).isAfter(
Jiffy(now).subtract(years: 1),
Units.DAY,
)) {
dayInfo = createdAt.format('dd/MM').toUpperCase();
} else {
dayInfo = createdAt.format('dd/MM/yyyy').toUpperCase();
}

return Column(
Expand Down

0 comments on commit 4957619

Please sign in to comment.