The RelativeTimeFormat
object is a constructor for objects that enable language-sensitive
relative time formatting.
Documentation RelativeTimeFormat by Mozilla Contributors, licensed under CC-BY-SA 2.5.
Static methods
staticsupportedLocalesOf(locales:String, ?options:RelativeTimeFormatSupportedLocalesOfOptions):Array<String>
staticsupportedLocalesOf(locales:Array<String>, ?options:RelativeTimeFormatSupportedLocalesOfOptions):Array<String>
Returns an array containing those of the provided locales that are supported without having to fall back to the runtime's default locale.
Constructor
new(?locales:String, ?options:RelativeTimeFormatOptions)
new(?locales:Array<String>, ?options:RelativeTimeFormatOptions)
Methods
format(value:Float, unit:RelativeTimeUnit):String
Formats a value and a unit according to the locale and formatting options of the given Intl.RelativeTimeFormat object.
formatToParts(value:Float, unit:RelativeTimeUnit):Array<RelativeTimeFormatPart>
Returns an Array of objects representing the relative time format in parts that can be used for custom locale-aware formatting.
resolvedOptions():RelativeTimeFormatResolvedOptions
Returns a new object with properties reflecting the locale and formatting options computed during initialization of the object.