toPeriod

fun DateRange.toPeriod(): Period

Converts this range into a Period of the same length. As a range is inclusive, if the start and end date are the same, the resulting period will contain one day.

Throws

if the range isn't bounded

fun DateTimeInterval.toPeriod(): Period
fun OffsetDateTimeInterval.toPeriod(): Period
fun ZonedDateTimeInterval.toPeriod(): Period

Converts this interval into a Period of the same length.

Throws

if the interval isn't bounded