toDatePeriod

fun String.toDatePeriod(): DatePeriod

Parses the ISO-8601 duration representation as a DatePeriod.

This function is equivalent to DateTimePeriod.parse, but will fail if any of the time components are not zero.

See also

Throws

if the text cannot be parsed, the boundaries of DatePeriod are exceeded, or any time components are not zero.