ciso8601 icon indicating copy to clipboard operation
ciso8601 copied to clipboard

Add ability to parse ISO 8601 duration to timedelta.

Open frenzyk opened this issue 6 years ago • 2 comments

Like in this lib: isodate Lib python code if needed

Examples: P1Y2M6DT20H46M20S PT1H5M26S PT9H55M

Wiki description

frenzyk avatar Jul 07 '18 13:07 frenzyk

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.

movermeyer avatar Jul 13 '18 14:07 movermeyer

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!

kinow avatar Nov 12 '21 20:11 kinow