-
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
Question: 11 days seems to output 1 week, is this the designed behaviour? #56
Comments
I think different people have different expectations from To clarify the current implementation, the behavior somehow matches |
I see the problem but I think we must add an option to define the amount of data that we are OK to lose in favour of presentation. Otherwise I'm sure in a lot of cases it's not acceptable to lose this much of data. |
I agree. That's being proposed in #29 and I will think about a way to do it. I also welcome a PR on this :) I am interested to know why you think "11 days" should return "11 days" and not "1 week and 4 days" (or 1 week, 4 days)? 11 days in the timespan dialect equals |
Well, to deal with this issue we first need to think about a Then we should ask ourselves how humans express this data when talking to each others which is very interesting becuase different people express this information in different ways. But we need to provide a solution that works just like what most people expect it to work. We need to know if most people say In my case and the people around me, we tend to use a single unit to express this kind of information instead of combining multiple units. I will give you an example: |
I agree that the way the TimeSpan is composed is immaterial. That was an example to show that one might expect to get 1 week and 4 days if they pass in the result of a (1 week + 4 days) TimeSpan. This observation could be made about many of the Humanizer's methods because most of them work in a very certain way with a very certain but loose language. As you said we should find out which variation is more common and implement that. |
I think we need atleast two different methods:
|
Thanks @hazzik. I was thinking about adding an optional public static string Humanize(this TimeSpan input, Precision precision = <<Precision.Default>>) This way the existing calls to |
This is partially addressed in #65. Will provide a way to provide the largest unit later. |
In my mindset I expect:
7 days -> 1 week
14 days -> 2 weeks
11 days -> 11 days
The text was updated successfully, but these errors were encountered: