minusYear

The YearMonth 12 months earlier.

Throws

if the result exceeds the boundaries of YearMonth.

Samples

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

fun main() { 
   //sampleStart 
   check(YearMonth(2023, Month.JANUARY).minusYear() == YearMonth(2022, Month.JANUARY)) 
   //sampleEnd
}