@formatjs/intl-relativetimeformat 11.2.5 → 11.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +5 -5
  2. package/polyfill.iife.js +7 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formatjs/intl-relativetimeformat",
3
- "version": "11.2.5",
3
+ "version": "11.2.6",
4
4
  "description": "Formats JavaScript dates to relative time strings.",
5
5
  "keywords": [
6
6
  "intl",
@@ -20,14 +20,14 @@
20
20
  "url": "git@github.com:formatjs/formatjs.git"
21
21
  },
22
22
  "dependencies": {
23
- "@formatjs/ecma402-abstract": "1.17.1",
24
- "@formatjs/intl-localematcher": "0.4.1",
23
+ "@formatjs/ecma402-abstract": "1.17.2",
24
+ "@formatjs/intl-localematcher": "0.4.2",
25
25
  "tslib": "^2.4.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@formatjs/intl-getcanonicallocales": "2.2.1",
29
- "@formatjs/intl-locale": "3.3.3",
30
- "@formatjs/intl-pluralrules": "5.2.5"
29
+ "@formatjs/intl-locale": "3.3.4",
30
+ "@formatjs/intl-pluralrules": "5.2.6"
31
31
  },
32
32
  "main": "index.js",
33
33
  "types": "index.d.ts",
package/polyfill.iife.js CHANGED
@@ -204,7 +204,7 @@
204
204
  if (availableLocale) {
205
205
  result.locale = availableLocale;
206
206
  if (locale !== noExtensionLocale) {
207
- result.extension = locale.slice(noExtensionLocale.length + 1, locale.length);
207
+ result.extension = locale.slice(noExtensionLocale.length, locale.length);
208
208
  }
209
209
  return result;
210
210
  }
@@ -230,12 +230,16 @@
230
230
  minimizedAvailableLocales.add(canonicalizedLocale);
231
231
  });
232
232
  var foundLocale;
233
+ var extension;
233
234
  for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
234
235
  var l = requestedLocales_1[_i];
235
236
  if (foundLocale) {
236
237
  break;
237
238
  }
238
239
  var noExtensionLocale = l.replace(UNICODE_EXTENSION_SEQUENCE_REGEX, "");
240
+ if (l !== noExtensionLocale) {
241
+ extension = l.slice(noExtensionLocale.length, l.length);
242
+ }
239
243
  if (availableLocales.has(noExtensionLocale)) {
240
244
  foundLocale = noExtensionLocale;
241
245
  break;
@@ -257,7 +261,8 @@
257
261
  return { locale: getDefaultLocale() };
258
262
  }
259
263
  return {
260
- locale: availableLocaleMap[foundLocale] || canonicalizedLocaleMap[foundLocale] || minimizedAvailableLocaleMap[foundLocale] || foundLocale
264
+ locale: availableLocaleMap[foundLocale] || canonicalizedLocaleMap[foundLocale] || minimizedAvailableLocaleMap[foundLocale] || foundLocale,
265
+ extension
261
266
  };
262
267
  }
263
268