Checks if this date is in the same year as other.
other
Example:
print(DateTime(2023, 1, 1).isSameYear(DateTime(2023, 12, 31))); // true
bool isSameYear(DateTime other) => year == other.year;