lastDayOfWeek static method
Implementation
static DateTime lastDayOfWeek(DateTime day) {
/// Handle Daylight Savings by setting hour to 12:00 Noon
/// rather than the default of Midnight
day = DateTime.utc(day.year, day.month, day.day, 12);
/// Weekday is on a 1-7 scale Monday - Sunday,
/// This Calendar's Week starts on Sunday
var increaseNum = day.weekday % 7;
return day.add(Duration(days: 7 - increaseNum));
}