countDays function

String countDays(
  1. int difference
)

Converts the time difference to a number of days. This function truncates to the lowest day. returns ("1 day" OR "X days")

Implementation

String countDays(int difference) {
  int count = (difference / 86400000).truncate();
  return count.toString() + (count > 1 ? ' days' : ' day');
}