compareTo method

int compareTo(
  1. EtDatetime other
)
override

Compares this EtDatetime object to other, returning zero if the values are equal.

Returns a negative value if this EtDatetime isBefore other. It returns 0 if it isAtSameMomentAs other, and returns a positive value otherwise (when this isAfter other).

Implementation

int compareTo(EtDatetime other) {
  if (this.isBefore(other)) {
    return -1;
  } else if (this.isAtSameMomentAs(other)) {
    return 0;
  } else {
    return 1;
  }
}