@formatjs/intl-datetimeformat 6.10.1 → 6.10.2

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 +4 -4
  2. package/polyfill.iife.js +7 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formatjs/intl-datetimeformat",
3
- "version": "6.10.1",
3
+ "version": "6.10.2",
4
4
  "description": "Intl.DateTimeFormat polyfill",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -22,12 +22,12 @@
22
22
  },
23
23
  "homepage": "https://github.com/formatjs/formatjs#readme",
24
24
  "dependencies": {
25
- "@formatjs/ecma402-abstract": "1.17.1",
26
- "@formatjs/intl-localematcher": "0.4.1",
25
+ "@formatjs/ecma402-abstract": "1.17.2",
26
+ "@formatjs/intl-localematcher": "0.4.2",
27
27
  "tslib": "^2.4.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@formatjs/intl-getcanonicallocales": "2.2.1",
31
- "@formatjs/intl-locale": "3.3.3"
31
+ "@formatjs/intl-locale": "3.3.4"
32
32
  }
33
33
  }
package/polyfill.iife.js CHANGED
@@ -498,7 +498,7 @@
498
498
  if (availableLocale) {
499
499
  result.locale = availableLocale;
500
500
  if (locale !== noExtensionLocale) {
501
- result.extension = locale.slice(noExtensionLocale.length + 1, locale.length);
501
+ result.extension = locale.slice(noExtensionLocale.length, locale.length);
502
502
  }
503
503
  return result;
504
504
  }
@@ -524,12 +524,16 @@
524
524
  minimizedAvailableLocales.add(canonicalizedLocale);
525
525
  });
526
526
  var foundLocale;
527
+ var extension;
527
528
  for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
528
529
  var l = requestedLocales_1[_i];
529
530
  if (foundLocale) {
530
531
  break;
531
532
  }
532
533
  var noExtensionLocale = l.replace(UNICODE_EXTENSION_SEQUENCE_REGEX, "");
534
+ if (l !== noExtensionLocale) {
535
+ extension = l.slice(noExtensionLocale.length, l.length);
536
+ }
533
537
  if (availableLocales.has(noExtensionLocale)) {
534
538
  foundLocale = noExtensionLocale;
535
539
  break;
@@ -551,7 +555,8 @@
551
555
  return { locale: getDefaultLocale() };
552
556
  }
553
557
  return {
554
- locale: availableLocaleMap[foundLocale] || canonicalizedLocaleMap[foundLocale] || minimizedAvailableLocaleMap[foundLocale] || foundLocale
558
+ locale: availableLocaleMap[foundLocale] || canonicalizedLocaleMap[foundLocale] || minimizedAvailableLocaleMap[foundLocale] || foundLocale,
559
+ extension
555
560
  };
556
561
  }
557
562