Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for negative duration values in ISO8601 period parsing #59

Closed
wants to merge 4 commits into from

Conversation

dgoldsb
Copy link

@dgoldsb dgoldsb commented Jul 19, 2019

Fixes #41.

We are using a mixed Java/Python stack, and would benefit from the addition of support for negative duration values in the ISO8601 period parsing. For example, PT6H-30M would correspond to a duration of 05:30:00.

As mentioned in #41, there is a precedent for supporting this format, looking for instance at MomentJS (moment/moment#2955).

@coveralls
Copy link

coveralls commented Jul 19, 2019

Coverage Status

Coverage remained the same at 94.433% when pulling ff45865 on dgoldsb:negative-duration-values into 27cebc5 on gweis:master.

r"(?P<days>-?[0-9]+([,.][0-9]+)?D)?"
r"((?P<separator>T)(?P<hours>-?[0-9]+([,.][0-9]+)?H)?"
r"(?P<minutes>-?[0-9]+([,.][0-9]+)?M)?"
r"(?P<seconds>-?[0-9]+([,.][0-9]+)?S)?)?$")
# regular expression to parse ISO duartion strings.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in duration :). Looks great!

@dgoldsb
Copy link
Author

dgoldsb commented Nov 2, 2021

Closing this as this module seems unmaintained, and reportedly does not function in Python 3.10.

@dgoldsb dgoldsb closed this Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Negative duration values
4 participants