Humanizr / Humanizer

Humanizer meets all your .NET needs for manipulating and displaying strings, enums, dates, times, timespans, numbers and quantities
Other
8.52k stars 947 forks source link

How to show smaller than milliseconds for TimeSpan? #1494

Closed lloydjatkinson closed 3 months ago

lloydjatkinson commented 3 months ago

I need to display microseconds from a TimeSpan, however right now all I'm able to get is "0 milliseconds".

timeSpan.Humanize(culture: culture);

Does Humanizer support displaying them?

SimonCropp commented 3 months ago

try using the precision override

public static string Humanize(this TimeSpan timeSpan, int precision, bool countEmptyUnits, CultureInfo? culture = null, TimeUnit maxUnit = TimeUnit.Week, TimeUnit minUnit = TimeUnit.Millisecond, string? collectionSeparator = ", ", bool toWords = false)
    {