lastDateAs method
Implementation
Date lastDateAs(int weekday, {bool returnIfToday = false}) {
Date start = this;
if (start.weekday == weekday) {
return returnIfToday ? start : start.addDays(-7);
}
while (start.weekday != weekday) {
start = start.addDays(-1);
}
return start;
}