isBeforeDay method

bool isBeforeDay(
  1. DateTime date
)

Returns true if this calendar day is earlier than the day of date, ignoring the time of both.

Example:

final date = DateTime(2024, 2, 24, 23, 0);
final check = date.isBeforeDay(DateTime(2024, 2, 24, 8, 0));
// returns: false

Implementation

bool isBeforeDay(DateTime date) => DateTime.utc(year, month, day).isBefore(
  DateTime.utc(date.year, date.month, date.day),
);