Interface DurationFormatOptions


@JsType(isNative=true, namespace="<global>") public interface DurationFormatOptions
Mapping for duration format options passed to DurationFormat constructors.

In addition to the actual mappings, this class implements the builder pattern using enums to create the options easily and in a type-safe manner. Some enums are shared with other format option builders of the Intl module and may contain more values than intended for the given method. In that case the allowed values are listed on the method. In all other cases all enum values are applicable.

var duration = duration()
        .hours(1)
        .minutes(46)
        .seconds(40);

// With style set to "long" and locale "fr-FR"
durationFormat("fr-FR", durationFormatOptions().style(long_)).format(duration);
// "1 heure, 46 minutes et 40 secondes"

// With style set to "short" and locale "en"
durationFormat("en", durationFormatOptions().style(short_)).format(duration);
// "1 hr, 46 min and 40 sec"

// With style set to "narrow" and locale "pt"
durationFormat("pt", durationFormatOptions().style(narrow)).format(duration);
// "1 h 46 min 40 s"
See Also: