firstDayNextMonth static method
Returns the first day of the month following the given month and year,
or null if month is invalid.
Implementation
@useResult
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 < DateConstants.minMonth || month > DateConstants.maxMonth) {
// invalid
return null;
}
// there are ALWAYS 28 days in any month
final DateTime someDayNextMonth = DateTime(
year,
month,
DateConstants.minDaysInAnyMonth,
).addDays(DateConstants.daysToAddToGetNextMonth);
return DateTime(someDayNextMonth.year, someDayNextMonth.month);
}