firstDayNextMonth static method
Calculates the first day of the next month for a given month and year.
Args: month (int): The month (1-12). year (int): The year.
Returns: DateTime?: The first day of the next month, or null if the month is invalid.
Implementation
static DateTime? firstDayNextMonth({required int month, required int year}) {
// ref: https://stackoverflow.com/questions/61881850/sort-list-based-on-boolean
// ref: https://stackoverflow.com/questions/67144785/flutter-dart-datetime-max-min-value
if (month < 1 || month > 12) {
// invalid
return null;
}
// there are ALWAYS 28 days in any month
final DateTime someDayNextMonth = DateTime(year, month, 28).addDays(4);
return DateTime(someDayNextMonth.year, someDayNextMonth.month);
}