closeio / ciso8601

Fast ISO8601 date time parser for Python written in C
MIT License
565 stars 45 forks source link

Add ability to parse ISO 8601 duration to timedelta. #65

Open frenzyk opened 6 years ago

frenzyk commented 6 years ago

Like in this lib: isodate Lib python code if needed

Examples: P1Y2M6DT20H46M20S PT1H5M26S PT9H55M

Wiki description

movermeyer commented 6 years ago

Thanks for the suggestion!

Do you have a need for this in your usage? Or is this request mostly to help make ciso8601 a complete ISO 8601 parser?

If you have an immediate need for a fast duration parser, Pendulum can already do this:

from pendulum.parsing import parse_iso8601
parse_iso8601("P1Y2M6DT20H46M20S").as_timedelta()

I'd be willing to accept a Pull Request for this.

kinow commented 2 years ago

Learned about ciso8601 via Arvados workflow manager that uses it as dependency. My previous job I worked on Cylc Flow, which uses metomi-isodatetime that also handles periods.

It is useful for tools like workflow managers if they want to allow for recurrence of tasks.

I'd be willing to accept a Pull Request for this.

:+1: shame I don't have time, but otherwise it'd be fun to work on this one.

Thanks for ciso8601!