isBeforeWithoutTime method
- DateTime? otherDate
Checks if the DateTime instance is before another DateTime instance when considering only the date (year, month, day) without the time.
Returns false if either the DateTime instance or otherDate is null.
Implementation
bool isBeforeWithoutTime(DateTime? otherDate) {
if (this == null || otherDate == null) return false;
final thisDate = DateTime(this!.year, this!.month, this!.day);
final otherDateOnly =
DateTime(otherDate.year, otherDate.month, otherDate.day);
return thisDate.isBefore(otherDateOnly);
}