isSameYear method

bool isSameYear(
  1. DateTime other
)

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

Example:

DateTime(2024, 1, 15).isSameYear(DateTime(2024, 12, 31)); // true

Implementation

bool isSameYear(DateTime other) {
  return year == other.year;
}