dayAgo function
Returns a string representing the day ago from the given date. Requires a
translation function tr to translate the string into the given locale.
Implementation
String dayAgo(DateTime date, String Function(String) tr, String locale) {
final delta = DateTime.now().difference(date);
const K = 'time_ago';
if (delta.inDays == 1) {
return tr('$K.yesterday');
}
return DateFormat('MMMM d, y', locale).format(date);
}