getDateTimeLastNDays function

Pair<DateTime> getDateTimeLastNDays(
  1. int nDays, [
  2. DateTime? time
])

Returns start and end of last nDays counting from time.

time if null uses DateTime.now .

Implementation

Pair<DateTime> getDateTimeLastNDays(int nDays, [DateTime? time]) {
  time ??= DateTime.now();
  return Pair(getDateTimeDayStart(time.subtract(Duration(days: nDays))),
      getDateTimeDayEnd(time));
}