lastOfMonth method

Date lastOfMonth()

Implementation

Date lastOfMonth() {
  var time = toDateTime();
  var currentMonth = time.month;
  DateTime temp;
  while (currentMonth == time.month) {
    temp = time.add(Duration(days: 1));
    if (temp.month != currentMonth) {
      return Date.fromDateTime(temp);
    }
    time = time.add(Duration(days: 1));
  }
  return Date.fromDateTime(time);
}