Metadata-Version: 2.1
Name: jetblack-iso8601
Version: 2.0.0
Summary: ISO 8601 support
Author-email: Rob Blackbourn <rob.blackbourn@gmail.com>
License: Apache-2.0
Project-URL: Homepage, https://github.com/rob-blackbourn/jetblack-iso8601
Project-URL: Issues, https://github.com/rob-blackbourn/jetblack-iso8601/issues
Keywords: iso8601,jetblack
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Requires-Dist: coverage; extra == "dev"
Requires-Dist: autopep8; extra == "dev"
Requires-Dist: pylint; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Provides-Extra: docs
Requires-Dist: mkdocs; extra == "docs"
Requires-Dist: mkdocs-material; extra == "docs"
Requires-Dist: jetblack-markdown; extra == "docs"
Requires-Dist: mike; extra == "docs"

# jetblack-iso8601

Support for ISO8601
(read the [docs](https://rob-blackbourn.github.io/jetblack-iso8601/)).

## Usage

### Timestamps

Timestamps can be parsed with `iso8601_to_datetime` and
converted to a string with `datetime_to_iso8601`.

```python
from jetblack_iso8601 import (
    iso8601_to_datetime,
    datetime_to_iso8601
)

text = '2014-02-01T09:28:56.321-10:00'
timestamp = iso8601_to_datetime(text)
roundtrip = datetime_to_iso8601(timestamp)
assert text == roundtrip
```

### Durations

Timestamps can be parsed with `iso8601_to_timedelta` and
converted to a string with `datetime_to_iso8601`.


```python
from jetblack_iso8601 import (
    iso8601_to_timedelta,
    timedelta_to_iso8601
)

text = 'P3Y2M1DT12H11M10S'
value = iso8601_to_timedelta(text)
roundtrip = timedelta_to_iso8601(value)
assert roundtrip == text
```
