Period.of_date_and_duration#

static Period.of_date_and_duration(date_duration)[source]#

Return a Period from date/duration string.

The Period’s timeline origin is set to the given date, and period steps built as normal from that origin.

Parameters:

date_duration (str) – An ISO 8601 duration string of the form <start>/<duration>, e.g. “2024-01-01/P1D”

Return type:

Period

Returns:

A Period object defined by the supplied ISO 8601 duration string

Raises:

PeriodParsingError – If the string does not contain a valid <start>/<duration> value.