RelativeTimeFormat

The Intl.RelativeTimeFormat object is a constructor for objects that enable language-sensitive relative time formatting.

Part of Intl object namespace and the ECMAScript Internationalization API.

Compatibility.

Polyfills.

class Object
trait Matchable
class Any

Value members

Concrete methods

@inline

Returns an array containing those of the provided locales that are supported in date and time formatting without having to fall back to the runtime's default locale.

Returns an array containing those of the provided locales that are supported in date and time formatting without having to fall back to the runtime's default locale.

Value Params
locales
  • A string with a BCP 47 language tag, or an array of such strings. For the general form and interpretation of the locales argument, see the Intl page.
options
  • An object with some or all of options of the formatting. An object with some or all of the following properties:
  • localeMatcher - The locale matching algorithm to use. Possible values are "lookup" and "best fit"; the default is "best fit". For information about this option, see Intl page.
  • numeric - The format of output message. Possible values are: "always" (default, e.g., 1 day ago) or "auto" (e.g., yesterday). The "auto" value allows to not always have to use numeric values in the output.
  • style - The length of the internationalized message. Possible values are: "long" (default, e.g., in 1 month), "short" (e.g., in 1 mo.) or "narrow" (e.g., in 1 mo.). The narrow style could be similar to the short style for some locales.

Concrete fields

@JSGlobal("Intl.RelativeTimeFormat") @native
val ^: Any