isSameWeek method

bool isSameWeek(
  1. DateTime other
)

Returns true if the date is in the same week as other.

Example:

DateTime(2024, 1, 15).isSameWeek(DateTime(2024, 1, 16)); // true

Implementation

bool isSameWeek(DateTime other) {
  return startOfWeek.isSameDay(other.startOfWeek);
}