-
Notifications
You must be signed in to change notification settings - Fork 965
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 option to customize list of time indicators of humanized timespans #497
Comments
The current implementation of |
Ok, cool ;) Concerning the implementation: adding a new overload is fine? |
Maybe already the use of the |
Tagging as vNext unless this can be completed in the next couple of weeks. |
@mexx I'm ooking into this. If I change the |
👍 Thanks! I started with this just after I created the issue, but I was unable to built the solution. And although, @ErikSchierboom commit shows it's a very simple change, I did wanted to be able to test my own work ;) FWIW, I remember that I did open the non-Dnx solution, nevertheless, I had build errors concerning Dnx. It might be useful to put in some notes in the |
Hi @tiesmaster, what sort of build errors are you seeing? The non-Dnx solution should build cleanly; the Dnx solution really only exists to host the dnx unit tests for now. |
@onovotny @MehdiK @hazzik What do you guys think about this question from @ErikSchierboom:
Actually we only change the output, however this might not be desired by all of the users of
|
@onovotny I tried reproducing it just now, and I got specifically errors on the Uwp projects (though I do have the Visual Studio Tools for Universal Windows Apps installed, but I am still on Windows 7). After disabling those projects, I was able to run the unit tests using the default runner of VS. However, both ReSharper and NCrunch runners don't work :( For NCrunch, I'm getting a @mexx FWIW, I know that my designers here wouldn't be too happy if a minor NuGet update of Humanizer would break our visual applications. My intention would have been to just add an overload to keep it backwards compatible, but making this the default in a major update would make me even happier ;) |
Minor bumps shouldn't change the output as @tiesmaster mentioned; but since we're making a major release, a breaking change like this is understandable as long as there's a way for users to get the old behaviors (through the optional param). I think this kind of settings/configs are more global than just method level. So perhaps we can add the separator as a global config and just leave it as is, allowing users to specify a different value. This way we are not introducing a breaking change while users can still define what they want as a separator. If more granular control is required we could then add the optional param defaulting to the old value! Thoughts? |
👍 |
My only concern overall is with the statics of global config. Aside from making it harder to run all of the tests in parallel, it could create limits if someone wants it configured a certain way in one context but not another. I've started a new discussion around this topic in #508 |
Pending the global config discussion, I have updated my code and submitted a PR: #511 In this code, I added a I could then fix the failing unit tests by passing I also considered making the |
I've put a comment on the PR. About the |
Okay, great. I've updated the PR according to your comment. |
Use collection formatter when humanizing timespans. Fixes #497
Awesome to see that this has been merged!! 🎉 Thanks! AFAICT, this is not yet publicly available on NuGet. Any idea when it will be? |
Probably this title needs some explanation ;) When you humanize a timespan, like this:
then you get "1 week, 1 day". However, what I want is to have the option to override the concatenation of the strings, to have an ", and", instead of only a comma between the second to last, and last item, making the output this:
AFAICT, you cannot do this now with Humanizer, and couldn't find an issue for this. I'd suggest adding a
separator
argument to the call, similar to how you can specify that on theHumanize
call for collections. However, I'm not sure if you want another overload for this, besides the other two.I'm happy to make a PR, if my proposal is accepted, and we can find a good way to add it to the API.
The text was updated successfully, but these errors were encountered: