isSameMonth method

bool isSameMonth(
  1. DateTime other
)

Checks if this date is in the same month as other.

Example:

print(DateTime(2023, 1, 1).isSameMonth(DateTime(2023, 1, 15))); // true

Implementation

bool isSameMonth(DateTime other) => year == other.year && month == other.month;