getTimeAgo static method

String getTimeAgo(
  1. String strDatetime
)

Implementation

static String getTimeAgo(String strDatetime) {
  final now = DateTime.now();
  final ago = CoreUtil.stringToDateTime(strDatetime);
  final dua = now.difference(ago);
  if (CoreConstants.locale == CoreConstants.localeEN) {
    return timeago.format(now.subtract(dua));
  } else {
    timeago.setLocaleMessages(CoreConstants.localeVILang, timeago.ViMessages());
    return timeago.format(now.subtract(dua), locale: CoreConstants.localeVILang);
  }
}