Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
timedelta formatter#8930
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
timedelta formatter#8930
Uh oh!
There was an error while loading.Please reload this page.
Conversation
@dstansby Did you base this formatting mini-language on anything? I'd like to implement something similar indateutil/dateutil#444, but I'm not aware of any standard way to do it. |
assert dt == tdelta | ||
@pytest.mark.parametrize('dt, fmt, out', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I think you'd probably want a lot more tests. What happens for a negativetimedelta
?
How about('{H:02}:{M:02}', timedelta(days=4, hours=0, minutes=0, seconds=4))
?
Is it a bit inconsistent with |
I'm going to close this in favour ofdateutil/dateutil#444 - I think doing this upstream in |
PR Summary
A new
TimedeltaFormatter
class for formattingtimedelta
objects. Unlikedatetime
objects there's nostrftime
method, so I've had to roll my own version. The docstring examples and tests I've added should make it clear how it works.This depends on PR#8730. See#8869 for tracker issue for plotting
timedelta
objects.