compareTo

actual open operator override fun compareTo(other: LocalDate): Int(source)
expect open operator override fun compareTo(other: LocalDate): Int(source)

Compares this date with the other date. Returns zero if this date represents the same day as the other (meaning they are equal to one other), a negative number if this date is earlier than the other, and a positive number if this date is later than the other.

Samples

import kotlinx.datetime.*
import kotlinx.datetime.format.*
import kotlin.random.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   // Comparing LocalDate values
check(LocalDate(2023, 4, 16) < LocalDate(2024, 3, 15))
check(LocalDate(2023, 4, 16) < LocalDate(2023, 5, 15))
check(LocalDate(2023, 4, 16) < LocalDate(2023, 4, 17))
check(LocalDate(-1000, 4, 16) < LocalDate(0, 4, 17)) 
   //sampleEnd
}
actual open operator override fun compareTo(other: LocalDate): Int(source)
actual open operator override fun compareTo(other: LocalDate): Int(source)