lastDayOfMonth static method
指定日期所在月的最后
Implementation
static DateTime lastDayOfMonth({DateTime? date}) {
if (date == null) date = DateTime.now();
var year = date.year;
var month = date.month + 1;
if (month > 12) {
year++;
month = 1;
}
DateTime lastMonth = DateTime(year, month);
var lastDay = firstDayOfMonth(date: lastMonth).add(Duration(days: -1));
return lastDay;
}