isSameDay method

bool isSameDay(
  1. DateTime other
)

Determines whether two DateTime objects are on the same day.

Example:

var date1 = DateTime(2023, 1, 1);
var date2 = DateTime(2023, 1, 1, 23, 59, 59);
print(date1.isSameDay(date2)); // Output: true

Implementation

bool isSameDay(DateTime other) {
  return year == other.year && month == other.month && day == other.day;
}