Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Closed

Conversation

@dstansby
Copy link
Member

PR Summary

A newTimedeltaFormatter 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 plottingtimedelta objects.

@dstansbydstansby added this to the2.2 (next next feature release) milestoneAug 1, 2017
@pganssle
Copy link
Member

@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.

assertdt==tdelta


@pytest.mark.parametrize('dt, fmt, out',
Copy link
Member

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))?

@pganssle
Copy link
Member

Is it a bit inconsistent withstrftime to useD for days rather thand?

@dstansbydstansby modified the milestones:v2.2,v3.0Jan 10, 2018
@tacaswelltacaswell modified the milestones:v3.0,v3.1Jul 7, 2018
@jklymakjklymak modified the milestones:v3.1.0,v3.2.0Feb 7, 2019
@dstansby
Copy link
MemberAuthor

I'm going to close this in favour ofdateutil/dateutil#444 - I think doing this upstream indateutil is the better way to go.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@pgansslepgansslepganssle left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

v3.2.0

Development

Successfully merging this pull request may close these issues.

4 participants

@dstansby@pganssle@tacaswell@jklymak

[8]ページ先頭

©2009-2025 Movatter.jp