Interface RelativeTimeFormatOptions


@JsType(isNative=true, namespace="<global>") public interface RelativeTimeFormatOptions
Mapping for relative time format options passed to RelativeTimeFormat 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 rtf1 = relativeTimeFormat("en", relativeTimeFormatOptions()
        .style(short_));

console.log(rtf1.format(3, quarter));
// Expected output: "in 3 qtrs."

console.log(rtf1.format(-1, day));
// Expected output: "1 day ago"

var rtf2 = relativeTimeFormat("es", relativeTimeFormatOptions()
        .numeric(auto));

console.log(rtf2.format(2, day));
// Expected output: "pasado maƱana"
See Also: