orNull

fun orNull(isoWeekYear: Int, isoWeekNumber: Int, dayOfWeek: DayOfWeek): LocalIsoWeekDate?(source)

Constructs a LocalIsoWeekDate instance from the given date components or returns null if a value is out of range or invalid.

The supported ranges of components:

Use LocalIsoWeekDate(isoWeekYear, isoWeekNumber, dayOfWeek) to throw an exception instead of returning null when the parameters are invalid.

Samples

import kotlinx.datetime.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   // Constructing a LocalIsoWeekDate or returning null if components are out of range
check(LocalIsoWeekDate.orNull(2004, 53, DayOfWeek.SATURDAY) == LocalIsoWeekDate(2004, 53, DayOfWeek.SATURDAY))
check(LocalIsoWeekDate.orNull(2004, 54, DayOfWeek.SATURDAY) == null) 
   //sampleEnd
}

fun orNull(isoWeekYear: Int, isoWeekNumber: Int, dayOfWeek: Int): LocalIsoWeekDate?(source)

Constructs a LocalIsoWeekDate instance from the given date components or returns null if a value is out of range or invalid.

The components isoWeekNumber and dayOfWeek are 1-based.

The supported ranges of components:

Use LocalIsoWeekDate(isoWeekYear, isoWeekNumber, dayOfWeek) to throw an exception instead of returning null when the parameters are invalid.

Samples

import kotlinx.datetime.*
import kotlin.test.*

fun main() { 
   //sampleStart 
   // Constructing a LocalIsoWeekDate or returning null if components are out of range
check(LocalIsoWeekDate.orNull(2004, 53, 6) == LocalIsoWeekDate(2004, 53, 6))
check(LocalIsoWeekDate.orNull(2004, 53, 8) == null) 
   //sampleEnd
}