parse
Parses a ISO-8601 duration string as a DateTimePeriod. If the time components are absent or equal to zero, returns a DatePeriod.
Additionally, we support the W
signifier to represent weeks.
Examples of durations in the ISO-8601 format:
P1Y40D
is one year and 40 days-P1DT1H
is minus (one day and one hour)P1DT-1H
is one day minus one hour-PT0.000000001S
is minus one nanosecond
Throws
if the text cannot be parsed or the boundaries of DateTimePeriod are exceeded.