@formatjs/intl-relativetimeformat

  • Version 10.0.1
  • Published
  • 2.77 MB
  • 3 dependencies
  • MIT license

Install

npm i @formatjs/intl-relativetimeformat
yarn add @formatjs/intl-relativetimeformat
pnpm add @formatjs/intl-relativetimeformat

Overview

Formats JavaScript dates to relative time strings.

Index

Classes

class RelativeTimeFormat

class RelativeTimeFormat {}

    constructor

    constructor(
    locales?: string | string[],
    options?: Intl.RelativeTimeFormatOptions
    );

      property localeData

      static localeData: Record<string, LocaleFieldsData>;

        property polyfilled

        static polyfilled: boolean;

          method format

          format: (value: number, unit: Intl.RelativeTimeFormatUnit) => string;

            method formatToParts

            formatToParts: (
            value: number,
            unit: Intl.RelativeTimeFormatUnit
            ) => Intl.RelativeTimeFormatPart[];

              method resolvedOptions

              resolvedOptions: () => Intl.ResolvedRelativeTimeFormatOptions;

                method supportedLocalesOf

                static supportedLocalesOf: (
                locales: string | string[],
                options?: Pick<Intl.RelativeTimeFormatOptions, 'localeMatcher'>
                ) => string[];

                  Package Files (1)

                  Dependencies (3)

                  Dev Dependencies (0)

                  No dev dependencies.

                  Peer Dependencies (0)

                  No peer dependencies.

                  Badge

                  To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                  You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@formatjs/intl-relativetimeformat.

                  • Markdown
                    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@formatjs/intl-relativetimeformat)
                  • HTML
                    <a href="https://www.jsdocs.io/package/@formatjs/intl-relativetimeformat"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>