OffsetDateTimeInterval

class OffsetDateTimeInterval(start: OffsetDateTime, endExclusive: OffsetDateTime) : TimePointInterval<OffsetDateTime>

A half-open interval between two offset date-times based on timeline order.

DateTime.MIN and DateTime.MAX are used as sentinels to indicate an unbounded (ie. infinite) start or end. An OffsetDateTime with either as the date-time component will be treated accordingly, regardless of the offset.

Constructors

OffsetDateTimeInterval
Link copied to clipboard
common
fun OffsetDateTimeInterval(start: OffsetDateTime = UNBOUNDED.start, endExclusive: OffsetDateTime = UNBOUNDED.endExclusive)

Types

Companion
Link copied to clipboard
common
object Companion

Functions

asDuration
Link copied to clipboard
common
fun asDuration(): Duration
Converts this interval into a Duration of the same length.
asPeriod
Link copied to clipboard
common
fun asPeriod(): Period
Converts this interval into a Period of the same length.
contains
Link copied to clipboard
common
open operator override fun contains(value: OffsetDateTime): Boolean
Checks if this interval contains value.
equals
Link copied to clipboard
common
open operator override fun equals(other: Any?): Boolean
hasBoundedEnd
Link copied to clipboard
common
open fun hasBoundedEnd(): Boolean
Checks if this interval's end is bounded, meaning it has a finite value.
hasBoundedStart
Link copied to clipboard
common
open fun hasBoundedStart(): Boolean
Checks if this interval's start is bounded, meaning it has a finite value.
hashCode
Link copied to clipboard
common
open override fun hashCode(): Int
hasUnboundedEnd
Link copied to clipboard
common
open override fun hasUnboundedEnd(): Boolean
Checks if this interval's end is unbounded.
hasUnboundedStart
Link copied to clipboard
common
open override fun hasUnboundedStart(): Boolean
Checks if this interval's start is unbounded.
isBounded
Link copied to clipboard
common
open fun isBounded(): Boolean
Checks if both the start and end of this interval are bounded, meaning it has a finite range.
isEmpty
Link copied to clipboard
common
open override fun isEmpty(): Boolean
Checks if this interval is empty.
isUnbounded
Link copied to clipboard
common
open fun isUnbounded(): Boolean
Checks if both the start and end of this interval are unbounded, meaning this is an infinite time period in both directions.
toString
Link copied to clipboard
common
open override fun toString(): String
Converts this interval to a string in ISO-8601 extended format.

Properties

endExclusive
Link copied to clipboard
common
open override val endExclusive: OffsetDateTime
The end of this interval, exclusive.
endInclusive
Link copied to clipboard
common
open override val endInclusive: OffsetDateTime
The end of this interval, inclusive.
lengthInDays
Link copied to clipboard
common
open val lengthInDays: LongDays
The number of 24-hour days in this interval.
lengthInHours
Link copied to clipboard
common
val lengthInHours: LongHours
The number of whole hours in this interval.
lengthInMicroseconds
Link copied to clipboard
common
val lengthInMicroseconds: LongMicroseconds
The number of whole microseconds in this interval.
lengthInMilliseconds
Link copied to clipboard
common
val lengthInMilliseconds: LongMilliseconds
The number of whole milliseconds in this interval.
lengthInMinutes
Link copied to clipboard
common
val lengthInMinutes: LongMinutes
The number of whole minutes in this interval.
lengthInMonths
Link copied to clipboard
common
val lengthInMonths: IntMonths
The number of whole months in this interval.
lengthInNanoseconds
Link copied to clipboard
common
val lengthInNanoseconds: LongNanoseconds
The number of whole nanoseconds in this interval.
lengthInSeconds
Link copied to clipboard
common
val lengthInSeconds: LongSeconds
The number of whole seconds in this interval.
lengthInWeeks
Link copied to clipboard
common
val lengthInWeeks: LongWeeks
The number of whole weeks in this interval.
lengthInYears
Link copied to clipboard
common
val lengthInYears: IntYears
The number of whole years in this interval.
start
Link copied to clipboard
common
open override val start: OffsetDateTime
The start of this interval, inclusive.

Extensions

asZonedDateTimeInterval
Link copied to clipboard
common
Converts this interval to an equivalent ZonedDateTimeInterval where both endpoints are given a fixed-offset time zone.
random
Link copied to clipboard
common
fun OffsetDateTimeInterval.random(): OffsetDateTime
Returns a random date within this interval using the default random number generator.
fun OffsetDateTimeInterval.random(random: Random): OffsetDateTime
Returns a random date within this interval using the supplied random number generator.
randomOrNull
Link copied to clipboard
common
fun OffsetDateTimeInterval.randomOrNull(): OffsetDateTime?
Returns a random date within this interval using the default random number generator or null if the interval is empty or unbounded.
fun OffsetDateTimeInterval.randomOrNull(random: Random): OffsetDateTime?
Returns a random date within this interval using the supplied random number generator or null if the interval is empty or unbounded.
toDateRange
Link copied to clipboard
common
fun OffsetDateTimeInterval.toDateRange(): DateRange
Returns this interval with the precision reduced to just the date.
toDateTimeInterval
Link copied to clipboard
common
Returns this interval with the precision reduced to only the local date and time.
toInstantInterval
Link copied to clipboard
common
fun OffsetDateTimeInterval.toInstantInterval(): InstantInterval
Converts this interval to an InstantInterval.
toZonedDateTimeInterval
Link copied to clipboard
common
Converts this interval to a ZonedDateTimeInterval using the specified strategy to adjust each endpoint to a valid date, time, and offset in zone.