Skip to main content

Utilities for parsing iso8601 intervals and durations

Project description

A set of utilities for parsing and validating ISO 8601 dates, times, durations, and intervals that also conform to the rfc3339 recommendations.

>>> from iso8601utils import parsers
>>> parsers.interval('2016-08-01T23:10:59.111Z/2016-08-08T00:13:23.001Z')
Interval(repeat=0, start=datetime.datetime(2016, 8, 1, 23, 10, 59, 111),
end=datetime.datetime(2016, 8, 8, 0, 13, 23, 1),
delta=(datetime.timedelta(6, 3743, 999890), MonthDelta(0)))

>>> parsers.interval('2002-08-15T16:20:05.100+08:10/2002-10-12T17:05:25.020-01:40')
Interval(repeat=0, start=datetime.datetime(2002, 8, 15, 16, 20, 5, 100, tzinfo=<TimezoneInfo(+8:10)>),
end=datetime.datetime(2002, 10, 12, 17, 5, 25, 20, tzinfo=<TimezoneInfo(-1:40)>),
delta=(datetime.timedelta(-3, 38119, 999920), MonthDelta(2)))

>>> parsers.duration('P3Y6M4DT12H30M5S')
Duration(timedelta=datetime.timedelta(4, 45005), monthdelta=MonthDelta(42))

>>> from iso8601utils import validators
>>> validators.interval('1999-12-31T16:00:00.000+04:00/P5DT7H')
True
>>> validators.interval('23P7DT5H')
False
>>> validators.duration('P3Y6M4W7DT12H30M5S')
True
>>> validators.duration('23P7DT5H')
False

This project does not currently parse week dates.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iso8601utils-0.0.3.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iso8601utils-0.0.3-py2-none-any.whl (7.3 kB view details)

Uploaded Python 2

File details

Details for the file iso8601utils-0.0.3.tar.gz.

File metadata

  • Download URL: iso8601utils-0.0.3.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for iso8601utils-0.0.3.tar.gz
Algorithm Hash digest
SHA256 1722eeb168ee556a4a3e9fd47345cb6d178b6b20c2cdee044cceaeb4779df401
MD5 b6653fd57a5eebc2d0477ddc797b7785
BLAKE2b-256 ee2ff224aff195e73c009c7ad4bf0b4aa68f2288f30ba4439868e1b9c53fb069

See more details on using hashes here.

File details

Details for the file iso8601utils-0.0.3-py2-none-any.whl.

File metadata

File hashes

Hashes for iso8601utils-0.0.3-py2-none-any.whl
Algorithm Hash digest
SHA256 8e7ccc06c2f520167932a7cac311e2679fbea99182007cde3cbccd267c89ae77
MD5 c30274bafe02547658e20d5848cfff50
BLAKE2b-256 a2cb80180e72a0f8dacedd0f86c17f054e2c4352a24fecd85d3650382c3c1423

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page