isAfterWithoutTime method

bool isAfterWithoutTime(
  1. DateTime? otherDate
)

Checks if the DateTime instance is after 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 isAfterWithoutTime(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.isAfter(otherDateOnly);
}