compareTo method

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

Compare dates

throws on null argument

non-null

Implementation

@override
int compareTo(Jalali other) {
  ArgumentError.checkNotNull(other, '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;
}