//core/io.islandtime.ranges/toDateRange
toDateRange¶
common
fun DateTimeInterval.toDateRange(): DateRange
fun OffsetDateTimeInterval.toDateRange(): DateRange
fun ZonedDateTimeInterval.toDateRange(): DateRange
Returns this interval with the precision reduced to just the date.
common
fun String.toDateRange(): DateRange
Converts a string to a DateRange.
The string is assumed to be an ISO-8601 time interval representation in extended format. The output of DateRange.toString can be safely parsed using this method.
Examples:
- `1990-01-04/1991-08-30`
- `../1991-08-30`
- `1990-01-04/..`
- `../..`
- (empty string)
Throws¶
io.islandtime.parser.DateTimeParseException | if parsing fails |
io.islandtime.DateTimeException | if the parsed time is invalid |
common
fun String.toDateRange(parser: GroupedDateTimeParser, settings: DateTimeParserSettings = DateTimeParserSettings.DEFAULT): DateRange
Converts a string to a DateRange using a specific parser.
A set of predefined parsers can be found in DateTimeParsers.
Throws¶
io.islandtime.parser.DateTimeParseException | if parsing fails |
io.islandtime.DateTimeException | if the parsed range is invalid |