previousMonth static method

DateTime previousMonth(
  1. DateTime m
)

Implementation

static DateTime previousMonth(DateTime m) {
  var year = m.year;
  var month = m.month;
  if (month == 1) {
    year--;
    month = 12;
  } else {
    month--;
  }
  return DateTime(year, month);
}