last_day_of_month function

int last_day_of_month(
  1. DateTime month
)

Implementation

int last_day_of_month(DateTime month) {
  var beginning_next_month = (month.month < 12)
      ? new DateTime(month.year, month.month + 1, 1)
      : new DateTime(month.year + 1, 1, 1);
  return beginning_next_month.subtract(new Duration(days: 1)).day;
}