getDateTimeThisWeek function

Pair<DateTime> getDateTimeThisWeek([
  1. DateTimeWeekDay? weekFirstDay,
  2. DateTime? now
])

Returns start and end of this week using time as reference.

time if null uses DateTime.now .

Implementation

Pair<DateTime> getDateTimeThisWeek(
    [DateTimeWeekDay? weekFirstDay, DateTime? now]) {
  now ??= DateTime.now();

  var weekStart = getDateTimeWeekStart(weekFirstDay, now);
  var weekEnd = getDateTimeWeekEnd(weekFirstDay, now);

  return Pair(getDateTimeDayStart(weekStart), getDateTimeDayEnd(weekEnd));
}