micktwomey / pyiso8601

ISO8601 formatted datetime parser for python
MIT License
34 stars 13 forks source link

Add durations #8

Open mcsitter opened 4 years ago

mcsitter commented 4 years ago

Hello,

i came across this package while working with the youtube data api which returns video durations in iso-8601 format. Other libraries are not maintained or rather big. I want to have a serverless FaaS so having a small parser is great. I am currently working with regular expressions, but a parser giving back more useful types instead of strings would be awesome.

Are you open to adding this functionality?

Spec for reference: wiki

I never wrote a parser, but would be happy to try and implement it.

micktwomey commented 3 years ago

I'd be very happy to receive any pull requests.

In this case it looks like durations are sufficiently different to warrant a new function (e.g. parse_duration).

Note: if you're looking for duration parsing there's another library, isodate, which might cover what you want: https://pypi.org/project/isodate/

yaalaa commented 1 year ago

+1


Must have durations.


I have to parse duration on front-end via Moment-js - fortunately it's enough for me just now. However - if tomorrow it will need to parse duration on back-end - I'll have to switch to pip isodate completely. Sorry Michael. It looks redundant to use two pips for the same need.