getDaysInMonth static method

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

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

Implementation

static int getDaysInMonth(int year, int month) {
  if (month == 12) {
    final bool isLeapYear = Jalali(year).isLeapYear();
    if (isLeapYear) return 30;
    return 29;
  }
  const List<int> daysInMonth = <int>[
    31,
    31,
    31,
    31,
    31,
    31,
    30,
    30,
    30,
    30,
    30,
    -1
  ];
  return daysInMonth[month - 1];
}