Skip to content

//core/io.islandtime.ranges/toInstantInterval

toInstantInterval

common

fun OffsetDateTimeInterval.toInstantInterval(): InstantInterval

fun ZonedDateTimeInterval.toInstantInterval(): InstantInterval

Converts this interval to an InstantInterval.

common

fun String.toInstantInterval(): InstantInterval

Converts a string to an InstantInterval.

The string is assumed to be an ISO-8601 time interval representation in extended format. The output of InstantInterval.toString can be safely parsed using this method.

Examples:

  • `1990-01-04T03Z/1991-08-30T15:30:05.123Z`
  • `../1991-08-30T15:30:05.123Z`
  • `1990-01-04T03Z/..`
  • `../..`
  • (empty string)

Throws

DateTimeParseException if parsing fails
DateTimeException if the parsed time is invalid

common

fun String.toInstantInterval(parser: GroupedDateTimeParser, settings: DateTimeParserSettings = DateTimeParserSettings.DEFAULT): InstantInterval

Converts a string to an InstantInterval using a specific parser.

A set of predefined parsers can be found in DateTimeParsers.

Throws

DateTimeParseException if parsing fails
DateTimeException if the parsed interval is invalid