isSameLocalWeekAs method
Returns whether this and other
is in same local week. Local week is determined by weekStart
, defaults to DateTime.monday
Assumes both this and other
is in local timezone.
Implementation
bool isSameLocalWeekAs(
DateTime other, [
int? weekStart,
]) {
weekStart ??= Moment.defaultLocalization.weekStart;
final DateTime startOfWeek = startOfLocalWeek(weekStart);
if (other < startOfWeek) return false;
final DateTime endOfWeek = endOfLocalWeek(weekStart);
return other <= endOfWeek;
}