getTimeAgo function
Implementation
String getTimeAgo(String? date) {
DateTime dateTime;
String? timeAgoString;
if (date != null) {
dateTime = DateFormat('E, MMM dd, yyyy hh:mm a').parse(date);
timeAgoString = timeago.format(dateTime, locale: 'en');
}
return timeAgoString ?? '';
}