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

Feature Request: Allow MaxUnit and MinUnit for TimeSpan #388

Closed
deadlydog opened this issue Mar 2, 2015 · 5 comments
Closed

Feature Request: Allow MaxUnit and MinUnit for TimeSpan #388

deadlydog opened this issue Mar 2, 2015 · 5 comments
Labels

Comments

@deadlydog
Copy link
Contributor

First off, this is a great package. Well done :)

Right now you have the ability to specify a precision integer for TimeSpans. This is great for hard-coded TimeSpans, but isn't flexible enough for calculated ones. In my scenario, I want to always have the TimeSpan represented down to the second, whether the time span is for 5 minutes or 5 days. Ideally I'm looking to be able to do something like:

(timeSpan1 - timeSpan2).Humanize(minUnit: TimeUnit.Second)

which would generate a string like:
"5 minutes, 15 seconds"
or
"2 days, 3 hours, 2 minutes, 33 seconds"

And to go along with that, being able to specify a maxUnit would be great too, so if I had also specified maxUnit: TimeUnit.Hour, then the above string would have been:
"51 hours, 2 minutes, 33 seconds"

Right now the documentation in the ReadMe.md says that maxUnit exists, but it is not in the latest stable NuGet package, which is currently 1.33.7. Maybe it's just still in a feature branch and not yet pushed to the NuGet Gallery?

@MehdiK
Copy link
Member

MehdiK commented Mar 4, 2015

Thanks for the nice words and suggestion @deadlydog

Funny you should mention this as maxUnit was implemented just a couple of days ago :) As you said it's not on nuget yet (will be in the next few minutes).

minUnit would be a nice addition too. Did you want to send us a PR? It should be relatively easy to implement on top of maxUnit.

@alimeziane
Copy link

Hi, I would like to work on this subject to participate in your project, that I find very useful. Is anyone treating this evolution or can I start it directly?
Thanks

@MehdiK
Copy link
Member

MehdiK commented Apr 9, 2015

Thanks @blackding. Cool. Go forth and conquer!
On 09/04/2015 7:29 PM, "BlackDing" notifications@github.com wrote:

Hi, I would like to work on this subject to participate in your project,
that I find very useful. Is anyone treating this evolution or can I start
it directly?
Thanks


Reply to this email directly or view it on GitHub
#388 (comment).

@danielbrezoi
Copy link
Contributor

Hi, I like this project and I rely want to participate. I have worked on this issue and now I want to sync the changes.
Sorry i haven't announce my intention, I hope it is OK.
Thanks.

@MehdiK
Copy link
Member

MehdiK commented May 24, 2015

Closed by #403

@MehdiK MehdiK closed this as completed May 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants