isoWeekYear
The week-year part of the week-date. Not to be confused with the LocalDate.year!
In most scenarios, this number is the same as the commonly used ISO year. However, the beginning and the end of the year can be different from LocalDate.year by several days, to ensure the week-year begins on a Monday.
Samples
import kotlinx.datetime.*
import kotlin.test.*
fun main() {
//sampleStart
// The ISO week year of a LocalIsoWeekDate corresponding to the date 2005-01-01
check(2004 == LocalDate(2005, 1, 1).toLocalIsoWeekDate().isoWeekYear)
//sampleEnd
}Content copied to clipboard