getDaysInMonth method
returns the number of days in a month
Implementation
int getDaysInMonth(
PickerType pickerType,
int year,
int month,
) {
if (pickerType == PickerType.jalali) {
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];
} else {
if (month == 2) {
final bool isLeapYear = DateHelper().isLeapYear(year);
if (isLeapYear) return 29;
return 28;
}
const List<int> daysInMonth = <int>[
31,
-1,
31,
30,
31,
30,
31,
31,
30,
31,
30,
31,
];
return daysInMonth[month - 1];
}
}