formatDate method

String formatDate()

Implementation

String formatDate() {
  final diff = DateTime.now().difference(this);

  if (diff < 1.days) {
    return "Today";
  } else if (diff < 2.days) {
    return "Yesterday";
  } else if (diff < 7.days) {
    return "Last ${DateFormat('EEEE').format(this)}";
  } else {
    return DateFormat('yMMMMd').format(this);
  }
}