Returns true if the date is in the same year as other.
true
other
Example:
DateTime(2024, 1, 15).isSameYear(DateTime(2024, 12, 31)); // true
bool isSameYear(DateTime other) { return year == other.year; }