Returns the last date in the list of dates.
DateTime? getLastDate(Iterable<DateTime>? dates) => dates?.tryReduce((a, b) => a.isAfter(b) ? a : b);