LocalIsoWeekDate
Constructs a LocalIsoWeekDate instance from the given date components.
The isoWeekNumber component is 1-based.
The supported ranges of components:
isoWeekYear the range is at least enough to represent dates of all instants between Instant.DISTANT_PAST and Instant.DISTANT_FUTURE
isoWeekNumber
1..52or1..53, depending on the isoWeekYear
Additionally, the full range of supported dates is exactly the same as that of LocalDate.
See also
for a version that returns null instead of throwing an exception when the parameters are invalid.
Throws
if any parameter is out of range or if isoWeekNumber is invalid for the given isoWeekYear.
Samples
import kotlinx.datetime.*
import kotlin.test.*
fun main() {
//sampleStart
// Constructing a LocalIsoWeekDate corresponding to the date 2005-01-01
val isoWeekDate = LocalIsoWeekDate(2004, 53, DayOfWeek.SATURDAY)
check(2004 == isoWeekDate.isoWeekYear) // note: not 2005!
check(53 == isoWeekDate.isoWeekNumber)
check(DayOfWeek.SATURDAY == isoWeekDate.dayOfWeek)
//sampleEnd
}Constructs a LocalIsoWeekDate instance from the given date components.
The components isoWeekNumber and dayOfWeek are 1-based.
The supported ranges of components:
isoWeekYear the range is at least enough to represent dates of all instants between Instant.DISTANT_PAST and Instant.DISTANT_FUTURE
isoWeekNumber
1..52or1..53, depending on the isoWeekYeardayOfWeek
1..7
Additionally, the full range of supported dates is exactly the same as that of LocalDate.
See also
for a version that returns null instead of throwing an exception when the parameters are invalid.
Throws
if any parameter is out of range or if isoWeekNumber is invalid for the given isoWeekYear.
Samples
import kotlinx.datetime.*
import kotlin.test.*
fun main() {
//sampleStart
// Constructing a LocalIsoWeekDate corresponding to the date 2005-01-01
val isoWeekDate = LocalIsoWeekDate(2004, 53, 6)
check(2004 == isoWeekDate.isoWeekYear) // note: not 2005!
check(53 == isoWeekDate.isoWeekNumber)
check(6 == isoWeekDate.dayOfWeek.isoDayNumber)
//sampleEnd
}