endOfLocalWeek method

DateTime endOfLocalWeek([
  1. int? weekStart
])

Returns start of the week based on weekStart. If it's null, it uses Moment.defaultLocalization.weekStart

Returned object will have same timezone as this

Implementation

DateTime endOfLocalWeek([int? weekStart]) {
  weekStart ??= Moment.defaultLocalization.weekStart;

  int delta = (weekStart + 6) - weekday;
  if (delta > 7) {
    delta -= 7;
  }

  return add(Duration(days: delta)).endOfDay();
}