lastWeekday method
Returns new DateTime instance of last n
th weekday
If today is the n
th day, will return 7 days in the past
Implementation
DateTime lastWeekday(int weekday) {
assert(weekday > -1 && weekday < 8,
"[Moment Dart] Weekday must be in range `0<=n<=7`");
final int requiredDelta = (this.weekday - weekday) % 7;
return this - Duration(days: requiredDelta == 0 ? 7 : requiredDelta);
}