isSameDay function

bool isSameDay(
  1. DateTime? a,
  2. DateTime? b
)

Helper function to compare two DateTime objects to check if they represent the same day.

This function compares only the year, month, and day parts of two DateTime objects.

Returns true if both DateTime objects are on the same day, otherwise returns false.

Implementation

bool isSameDay(DateTime? a, DateTime? b) {
  if (a == null || b == null) return false;
  return a.year == b.year && a.month == b.month && a.day == b.day;
}