VerdandiInterval

A half-open time interval [start, end) between two VerdandiMoment instances.

Intervals are always normalized so that startend. They can be created through the com.github.abraga.verdandi.Verdandi entry point:

val recent = Verdandi.interval { last thirty days }
val custom = Verdandi.interval("2025-01-01T00:00:00Z", "2025-12-31T23:59:59Z")
val range = Verdandi.interval(startMs..endMs)

Operations

Intervals expose set-like operations and duration computation through VerdandiIntervalOperationScope:

interval.contains(moment)
interval.overlaps(other)
interval.intersection(other)
interval.union(other)
interval.duration() // DateTimeDuration

Adjustments

The adjust DSL allows shifting, expanding, shrinking, and aligning interval bounds:

val adjusted = interval adjust {
shiftBoth(2.hours)
alignToFullDays()
}

Factory access

An interval also implements VerdandiFromMomentFactoryScope, allowing creation of moments relative to it:

val midpoint = interval.at(
year = 2025, month = 6, day = 15
)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

the exclusive upper bound of the interval.

Link copied to clipboard

the inclusive lower bound of the interval.

Functions

Link copied to clipboard

Adjusts this interval using the interval-specific DSL.

Link copied to clipboard
open override fun contains(other: VerdandiMoment): Boolean
Link copied to clipboard
open override fun duration(): DateTimeDuration
Link copied to clipboard
open override fun expand(duration: Duration): VerdandiInterval
Link copied to clipboard
open infix override fun from(moment: VerdandiMoment): VerdandiInterval
Link copied to clipboard
open override fun intersection(other: VerdandiInterval): VerdandiInterval?
Link copied to clipboard
open override fun isEmpty(): Boolean
Link copied to clipboard
open operator override fun minus(duration: Duration): VerdandiInterval
Link copied to clipboard
open override fun overlaps(other: VerdandiInterval): Boolean
Link copied to clipboard
open operator override fun plus(duration: Duration): VerdandiInterval
Link copied to clipboard
open override fun shrink(duration: Duration): VerdandiInterval
Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
open override fun union(other: VerdandiInterval): VerdandiInterval?