countMonths function

String countMonths(
  1. int difference
)

Implementation

String countMonths(int difference) {
  int count = (difference / 2628003000).round();
  count = count > 0 ? count : 1;
  if (count > 12) {
    return 'one year';
  }
  return count.toString() + (count > 1 ? ' months' : ' month');
}