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:
-
Method Summary
Modifier and TypeMethodDescriptiondefault RelativeTimeFormatOptionslocalMatcher(Matcher localeMatcher) Allowed values:Matcher.lookup,Matcher.bestFit.default RelativeTimeFormatOptionsnumberingSystem(NumberingSystem numberingSystem) The numbering system to use for number formatting, such as "arab", "hans", "mathsans", and so on.default RelativeTimeFormatOptionsAllowed values:When.always,When.auto.static RelativeTimeFormatOptionsvoidsetLocaleMatcher(String localeMatcher) voidsetNumberingSystem(String numberingSystem) voidsetNumeric(String numeric) voiddefault RelativeTimeFormatOptions
-
Method Details
-
relativeTimeFormatOptions
-
setLocaleMatcher
-
setNumberingSystem
-
setNumeric
-
setStyle
-
localMatcher
Allowed values:Matcher.lookup,Matcher.bestFit. -
numberingSystem
The numbering system to use for number formatting, such as "arab", "hans", "mathsans", and so on. For a list of supported numbering system types, seeIntl.supportedValuesOf(Category). -
numeric
Allowed values:When.always,When.auto. -
style
-