/Haxe JavaScript


package js.lib.intl

Available on js

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:Null<RelativeTimeFormatSupportedLocalesOfOptions>):Array<String>

staticsupportedLocalesOf(locales:Array<String>, ?options:Null<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.


new(?locales:String, ?options:Null<RelativeTimeFormatOptions>)

new(?locales:Array<String>, ?options:Null<RelativeTimeFormatOptions>)


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.


Returns a new object with properties reflecting the locale and formatting options computed during initialization of the object.

© 2005–2020 Haxe Foundation
Licensed under a MIT license.