Skip to main content
Version: 4.0 (next)

Humanizer.IGrammaticalCaseTimeSpanHumanizeStrategy

IGrammaticalCaseTimeSpanHumanizeStrategy Interface

Optionally extends a time-span humanization strategy with grammatical-case support. Existing ITimeSpanHumanizeStrategy implementations remain valid for existing duration APIs but cannot service HumanizeWithCase.

public interface IGrammaticalCaseTimeSpanHumanizeStrategy : Humanizer.ITimeSpanHumanizeStrategy

Derived
DefaultTimeSpanHumanizeStrategy

Implements ITimeSpanHumanizeStrategy

Methods

IGrammaticalCaseTimeSpanHumanizeStrategy.Humanize(TimeSpan, int, bool, CultureInfo, TimeUnit, TimeUnit, string, bool, GrammaticalCase) Method

Converts a System.TimeSpan using locale-authored unit-case phrases.

string Humanize(System.TimeSpan timeSpan, int precision, bool countEmptyUnits, System.Globalization.CultureInfo? culture, Humanizer.TimeUnit maxUnit, Humanizer.TimeUnit minUnit, string? collectionSeparator, bool toSymbols, Humanizer.GrammaticalCase grammaticalCase);

Parameters

timeSpan System.TimeSpan

The time span to humanize.

precision System.Int32

The maximum number of time units to return.

countEmptyUnits System.Boolean

Whether empty time units count toward precision.

culture System.Globalization.CultureInfo

The culture to use. If null, the current culture is used.

maxUnit TimeUnit

The maximum unit of time to output.

minUnit TimeUnit

The minimum unit of time to output.

collectionSeparator System.String

The separator used to combine time parts. If null, the culture's default collection formatter is used.

toSymbols System.Boolean

Whether time units are rendered as symbols.

grammaticalCase GrammaticalCase

The grammatical case used to select each unit phrase.

Returns

System.String
A bare locale-authored duration phrase whose count may be explicit or encoded by the unit form.

Exceptions

System.ArgumentOutOfRangeException
grammaticalCase is outside its defined enum range.

System.NotSupportedException
The selected locale, formatter, or duration unit does not have verified support for grammaticalCase.