--- id: isoduration version: "20.11.0" license: unclear license_treatment: permissive maintenance: abandoned --- # isoduration — Operations with ISO 8601 durations License: permissive · Maintenance: abandoned · Popularity: top 1,000 on PyPI ## Install pip install isoduration uv add isoduration poetry add isoduration ## Description # isoduration: Operations with ISO 8601 durations. [![PyPI Package](https://img.shields.io/pypi/v/isoduration?style=flat-square)](https://pypi.org/project/isoduration/) ## What is this. ISO 8601 is most commonly known as a way to exchange datetimes in textual format. A lesser known aspect of the standard is the representation of durations. They have a shape similar to this: ``` P3Y6M4DT12H30M5S ``` This string represents a duration of 3 years, 6 months, 4 days, 12 hours, 30 minutes, and 5 seconds. The state of the art of ISO 8601 duration handling in Python is more or less limited to what's offered by [`isodate`](https://pypi.org/project/isodate/). What we are trying to achieve here is to address the shortcomings of `isodate` (as described in their own [_Limitations_](https://github.com/gweis/isodate/#limitations) section), and a few of our own annoyances with their interface, such as the lack of uniformity in their handling of types, and the use of regular expressions for parsing. ## How to use it. This package revolves around the [`Duration`](src/isoduration/types.py) type. Given a ISO duration string we can produce such a type by using the... ## AI interpretation — verify before relying Parse, format, and perform arithmetic operations on ISO 8601 duration strings (e.g., P3Y6M4DT12H30M5S), with support for years and months that timedelta cannot represent. Verdict: isoduration cleanly solves ISO 8601 duration parsing with a design addressing isodate shortcomings, but its abandonment since 2020-11-01 is a significant risk. Use only if you can tolerate no upstream fixes and are confident the current behavior meets your needs indefinitely. [View on SkillFed](https://skillfed.io/packages/isoduration) · [View on PyPI](https://pypi.org/project/isoduration/)