getLastDayOfMonth static method
Returns a date with the same month and year of the specified date, and the last day of that month.
If month
is not specified, return the last day of the current month.
Implementation
static DateTime getLastDayOfMonth({DateTime? month}) {
DateTime firstDayOfNextMonth = getFirstDayOfNextMonth(month: month);
return firstDayOfNextMonth.subtract(const Duration(days: 1)).getDateOnly();
}