getDaysInMonth static method

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

Returns the number of days in a month, according to the proleptic Gregorian calendar.

This applies the leap year logic introduced by the Gregorian reforms of 1582. It will not give valid results for dates prior to that time.

Implementation

static int getDaysInMonth(int year, int month) {
  if (month == JalaliDate.esfand) {
    final bool isLeapYear = Jalali(year, month).isLeapYear();
    if (isLeapYear) return 30;
    return 29;
  }
  return _daysInMonth[month - 1];
}