compareTo method

  1. @override
int compareTo(
  1. Gregorian other
)
override

Compare dates

Implementation

@override
int compareTo(Gregorian other) {
  if (year != other.year) {
    return year > other.year ? 1 : -1;
  }

  if (month != other.month) {
    return month > other.month ? 1 : -1;
  }

  if (day != other.day) {
    return day > other.day ? 1 : -1;
  }

  return 0;
}