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 human friendly duration formatting #92

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

jbsmith7741
Copy link

This is a proposal for issue #55 by adding a new humanize.Duration(format string, d time.Duration) function.
supports year, month (30 days), week, day, hour, minute and seconds. zero values fields are not populated and times are broken down by the requested formats. Examples are in tests

@alexykot
Copy link

alexykot commented Mar 9, 2021

Any chance to get this merged? I need this function as well, but we'll have to maintain a fork until this PR is merged.

@sheldonhull
Copy link

Bump. This would be a nice humanize feature I've missed from other languages. Duration for stop watch type output being human friendly would be pretty nifty.

@mooijtech
Copy link

Would be nice to have this, 2023 now, no right to complain I could do it myself.
You can get a time.Time from a Duration like so: endTime := time.Now().Add(-time.Since(startTime))
Nice library.

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.

4 participants