# compareTo method

1. @override

int compareTo(

1. LocalDate other

)
override

Compares this date with another.

Returns a negative value if this is before `other`, 0 if equal, and a positive value if after.

## Implementation

    @override
    int compareTo(LocalDate other) {
      int result = year.compareTo(other.year);
      if (result != 0) return result;
      result = month.compareTo(other.month);
      if (result != 0) return result;
      return day.compareTo(other.day);
    }