getChatTime method

String getChatTime(
  1. BuildContext context,
  2. int? epochTime
)

Implementation

String getChatTime(BuildContext context, int? epochTime) {
  if (epochTime == null) return "";
  if (epochTime == 0) return "";
  var convertedTime = epochTime; // / 1000;
  //messageDate.time = convertedTime
  var hourTime = manipulateMessageTime(
      context, DateTime.fromMicrosecondsSinceEpoch(convertedTime));
  var currentYear = DateTime.now().year;
  calendar = DateTime.fromMicrosecondsSinceEpoch(convertedTime);
  var time = (currentYear == calendar.year)
      ? DateFormat("dd-MMM-yyyy").format(calendar)
      : DateFormat("yyyy/MM/dd").format(calendar);
  return "$time at $hourTime";
}