Checks whether the date is in the same year as the given date
date
bool isSameYear(DateTime date) { return date.year == year; }