mostRecentWeekday method
Returns the most recent occurrence of the specified weekday.
Args:
weekdayTarget: The target weekday (1 = Monday, 7 = Sunday).
Returns: The most recent date that falls on the target weekday. Audited: 2026-06-12 11:26 EDT
Implementation
@useResult
DateTime mostRecentWeekday(int weekdayTarget) =>
DateTime(year, month, day - (weekday - weekdayTarget) % DateConstants.daysPerWeek);