operator <= method

bool operator <=(
  1. DateTime otherDate
)

Returns true if left side is before Right side or on same date.

final checkDate = DateTime.now();   // 16-09-2023
checkDate.prevDay <= DateTime.now()  // true
checkDate <= DateTime.now()          // true
checkDate.nextDay <= DateTime.now()  // true

The comparison is independent of whether the time is in UTC or in the local time zone

Implementation

bool operator <=(DateTime otherDate) =>
    isBefore(otherDate) || isAtSameMomentAs(otherDate);