Class DurationFormat

java.lang.Object
org.jboss.elemento.intl.DurationFormat

@JsType(isNative=true, namespace="<global>", name="Intl.DurationFormat") public class DurationFormat extends Object
Mapping for Intl.DurationFormat.

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: