Skip to content

//core/io.islandtime.ranges/toInstantIntervalAt

toInstantIntervalAt

common

fun DateRange.toInstantIntervalAt(zone: TimeZone): InstantInterval

Converts this range to an InstantInterval between the start of the first day and the end of the last day in zone.

common

fun DateTimeInterval.toInstantIntervalAt(zone: TimeZone): InstantInterval

Converts this interval to an InstantInterval where both endpoints are in zone.

Due to daylight savings time transitions, there a few complexities to be aware of. If the local time of either endpoint falls within a gap (meaning it doesn't exist), it will be adjusted forward by the length of the gap. If it falls within an overlap (meaning the local time exists twice), the earlier offset will be used.