lastDayOfWeek method

DayDart lastDayOfWeek([
  1. Object? date
])

Implementation

DayDart lastDayOfWeek([Object? date]) {
  /// Handle Daylight Savings by setting hour to 12:00 Noon
  /// rather than the default of Midnight
  DayDart d = clone(date)..hour(12);

  /// Weekday is on a 1-7 scale Monday - Sunday,
  /// This Calendar's Week starts on Sunday
  var increaseNum = d.week() % 7;
  if (increaseNum == 0) {
    increaseNum = 8;
  }

  return d.add(7 - increaseNum, DayUnits.D);
}