ISO 8601 duration and dateutil.relativedelta.relativedelta
Hello,
aniso8601.parse_duration should be able to return a dateutil.relativedelta.relativedelta from a duration ISO 8601 string (because years don't have always 365 days and months 30 days)
see also https://bugs.launchpad.net/dateutil/+bug/1507735
Kind regards
Comments (7)
-
reporter -
repo owner Interesting, dateutil provides an easy way to provide calendar level accuracy to both
parse_duration
andparse_interval
.I've branched 1.1.0 dev and added a 'relative' keyword argument to both
parse_duration
andparse_interval
. Whenrelative=False
, the old behavior is used (a year is 365 days, a month is 30 days), whenrelative=True
, dateutil.relativedelta is used, allowing proper calendar accuracy where possible. README has been updated accordingly.Is that what you had in mind? If yes, I can tag and release v.1.1.0 to PyPI.
-
repo owner - marked as enhancement
-
reporter I don't know exactly what is the best approach between Pandas DateOffset and dateutil.relativedelta. But I like how you did this.
-
repo owner Pandas is much too large of a dependency (3+ megs) to introduce into a small library like this. dateutil adds nice calendar correct functionality with a comparatively small size (~200 k).
dateutil relativedelta support is included in v1.1.0, which has been released on PyPI. It functions as described in the above comment.
Marking this done.
-
repo owner - changed status to resolved
Desired functionality has been added in 1.1.0.
-
reporter Thanks Brandon
Kind regards
- Log in to comment
If you don't want to use dateutil an other approach could be to use Pandas DateOffset like