isBefore method
returns true if first is before second
Implementation
bool isBefore(
DateTime first,
DateTime second, {
bool needDayComparison = true,
}) {
return first.year < second.year ||
(first.year == second.year && first.month < second.month) ||
(needDayComparison &&
(first.year == second.year &&
first.month == second.month &&
first.day < second.day));
}