compareDateTimeToNow static method

int compareDateTimeToNow(
  1. DateTime dateTime
)

Implementation

static int compareDateTimeToNow(DateTime dateTime) {
  DateTime now = DateTime.now();
  int result = dateTime.compareTo(DateTime.now());
  if (result == -1) {
    if (dateTime.year == now.year &&
        dateTime.month == now.month &&
        dateTime.day == now.day) {
      return 0;
    }
    return -1;
  }
  return result;
}