These are chat archives for Humanizr/Humanizer
Humanizer meets all your .NET needs for manipulating and displaying strings, enums, dates, times, timespans, numbers and quantities
Hi, how would I change the outputted GrammaticalCase of a
1.Weeks().Humanize() => "Eine Woche", but I'd prefer
"einer Woche" (especially mind the extra
I want to write
"in one week"/
"in einer Woche", but at the current stage
"in "+1.Weeks().Humanize() doesn't work, and any GrammaticalCase-Methods are for DateTime, not TimeSpan.
For now I handle this special case in-situ, as any higher number of weeks is a number, but this will break as soon as want to include more languages than English and German.
While we are at it, (1) can I communicate to Humanizer that I want the number small (
eine Woche instead of
Eine Woche) and (2) can I specify a TimeUnit that is rounded up to (
1.Minute().Humanize(atLeast: TimeUnit.Day) =>
For the former I transform it manually to a lowercase-number.
For the later I currently use
new TimeSpan(Math.Max(myTimeSpan.Ticks, 1.Days().Ticks)).Humanize(), which is a bit unwieldy in the long run.
As the test shows
TimeSpan.FromMilliseconds(10).Humanize(minUnit: <Anything higher than ms>) returns
no time. But there is some time in the TimeSpan, that I want to round to the nearest day (in my case).
minUnit doesn't achieve that. The only way so far seems to do the rounding manually beforehand.
I see the thought behind
no time, but I would like to know if an
roundUpTo- construct is on-topic for this project or if I'm better off doing it all by myself.