rangeUntil

actual operator fun rangeUntil(that: YearMonth): YearMonthRange(source)
expect operator fun rangeUntil(that: YearMonth): YearMonthRange(source)

Creates a YearMonthRange from this to that, exclusive, i.e., from this to (that - 1 month)

Samples

import kotlinx.datetime.*
import kotlin.random.Random
import kotlin.test.Test

fun main() { 
   //sampleStart 
   // Creating YearMonthRange from YearMonth
check((YearMonth(2000, 1)..YearMonth(2000, 5)).toList() == listOf(
    YearMonth(2000, 1),
    YearMonth(2000, 2),
    YearMonth(2000, 3),
    YearMonth(2000, 4),
    YearMonth(2000, 5)
))
check(
    (YearMonth(2000, 1)..<YearMonth(2000, 6)).toList() == listOf(
        YearMonth(2000, 1),
        YearMonth(2000, 2),
        YearMonth(2000, 3),
        YearMonth(2000, 4),
        YearMonth(2000, 5)
    ))
check(
    (YearMonth(2000, 5) downTo YearMonth(2000, 1)).toList() == listOf(
        YearMonth(2000, 5),
        YearMonth(2000, 4),
        YearMonth(2000, 3),
        YearMonth(2000, 2),
        YearMonth(2000, 1)
    )) 
   //sampleEnd
}
actual operator fun rangeUntil(that: YearMonth): YearMonthRange(source)