lastDayInWeek method
本周最后一天
firstWeekDay
- 设置每周起始日, assert(firstWeekDay > 0 && firstWeekDay < 7)
Implementation
DateTime lastDayInWeek([int firstWeekDay = 1]) {
assert(firstWeekDay > 0 && firstWeekDay < 7);
DateTime _day =
this.subtract(Duration(days: (7 + weekday - firstWeekDay) % 7 - 6));
return DateTime(_day.year, _day.month, _day.day);
}