getDaysInMonth static method

int getDaysInMonth(
  1. int year,
  2. int month
)

获取这个月的天数

Implementation

static int getDaysInMonth(int year, int month) {
  if (month == DateTime.february) {
    final bool isLeapYear =
        (year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0);
    if (isLeapYear) return 29;
    return 28;
  }
  return _daysInMonth[month - 1];
}