Skip to content
This repository has been archived by the owner on Jul 10, 2019. It is now read-only.

Releases: formatjs/intl-relativeformat

v2.1.0 — short relative formats

11 Oct 11:45
v2.1.0
Compare
Choose a tag to compare

v2.0.0 — Upgraded to Latest intl-messageformat

10 Jul 11:49
v2.0.0
Compare
Choose a tag to compare

v1.3.0 — CLDR 28

06 Mar 22:31
Compare
Choose a tag to compare

This minor release upgrades the locale data to CLDR 28 and [email protected].

v1.2.0 — Upgraded to Latest intl-messageformat

27 Oct 05:17
Compare
Choose a tag to compare

v1.1.0 — Fixed Locale Data, Added `now` Option

17 Mar 16:38
Compare
Choose a tag to compare

This feature release fixes issues with the locale data—particularly with zh-Hant locales (#25)—plus adds support for more locales (#28), and support for passing a "now" has been added to the format() method (#26, @jbaudanza).

Fixed Locale Data

The locale data has been vastly improved in the following ways:

  • Added locale data for all leaf locales which differ from their root locale's data; e.g. zh-Hant-HK is not the same as zh-Hant which is not the same as zh.
  • Properly de-duplicate data for all CLDR locales by correctly traversing a locale's hierarchy of ancestor locales.
  • Added data for the following languages:
    aa, agq, bas, bh, ckb, dav, dje, dsb, dua, dv, dyo, ebu, ewo, guw, guz, hsb, ia, in, iu, iw, jbo, ji, jv, jw, kaj, kam, kcg, khq, ki, kln, kok, ksf, ku, lb, lu, luo, luy, mer, mfe, mgh, mo, mua, nah, nmg, no, nqo, nus, ny, pap, prg, qu, rn, rw, sbp, sh, sma, smi, smj, smn, sms, swc, syr, tk, tl, twq, vai, wa, wo, yav, yi, zgh

Improved Locale Resolution

This release also includes improvements for how locales are resolved. Here are some details of these changes:

  • If no extra locale data is loaded, the locale will always resolved to en.

  • If locale data is missing for a leaf locale like fr-FR, but there is data for the root, fr in this case, then its root will be used.

  • If there's data for the specified locale, then that locale will be resolved; i.e.,

    var rf = new IntlRelativeFormat('en-US');
    assert(rf.resolvedOptions().locale === 'en-US'); // true
  • The resolved locales are now normalized; e.g., en-us will resolve to: en-US.

Added now Option

A "now" can now be passed when calling the format() method to control what the date being formatted is relative to. Having this option improves testability, while also allowing format() to be a pure function and not rely on a temporal global value, Date.now().

var now = 1425839825400;
var rf  = new Intl.RelativeFormat();
rf.format(someDate, {now: now});

v1.0.3 — Fixed Support for ES3 + Browserify/Webpack

23 Jan 23:31
Compare
Choose a tag to compare

This patch release actually fixes the issue brought up in formatjs/intl-messageformat#90 so that the Browserify/Webpack output is compatible with ES3 environments. The previous release had .defaults in the transpiled CommonJS modules, the es6-module-transpiler has been updated to fix that, and this release contains those fixes.

v1.0.2 — Support for ES3 + Browserify/Webpack, Fixed Minified Source Maps

17 Jan 20:18
Compare
Choose a tag to compare

This patch release fixes the issue brought up in formatjs/intl-messageformat#90 so that the Browserify/Webpack output is compatible with ES3 environments. Source maps for .min.js files have also been fixed so that they now include the actual source code.

v1.0.1 — Support for Browserify/Webpack

10 Dec 00:28
Compare
Choose a tag to compare

This patch release improves support for using Browserify or Webpack to bundle intl-relativeformat. Since the context of these tools is to bundle for the browser, this release will only include the English locale data in the bundle by default. (Previously the data for all locales would be included when bundling with Browserify or Webpack.)

When you need to support another locale in your app and you're using Browserify or Webpack, we recommend the following approach:

// app.js
var IntlRelativeFormat = window.IntlRelativeFormat = require('intl-relativeformat');
// ...
<script src="/app.bundle.js"></script>
<script src="/intl-relativeformat/dist/locale-data/fr.js"></script>

This will expose IntlRelativeFormat as a global object in the browser, allowing you to load the script for the locale data you need for the page or current request.

Propagate Original locales Value

Fixed issue #17 where the original locales value the user passed to the IntlRelativeFormat constructor was not being propagated to the internal IntlMessageFormat instances. Instead, only the resolved root locale was being propagated. This issue would arise when using the Intl.js polyfill.

Source Maps Improvements

This release also includes improvements to source maps, making debugging easier.

Initial Release

07 Oct 22:49
Compare
Choose a tag to compare

Intl-relativeformat aims to provide a way to format different variations of relative time. You can use this package in the browser and on the server via Node.js.

This implementation is very similar to moment.js, in concept, although it provides only formatting features based on the Unicode CLDR locale data, an industry standard that supports more than 150 locales.