@formatjs/intl-datetimeformat 4.2.5 → 4.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.
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./src/core"), exports);
4
+ (0, tslib_1.__exportStar)(require("./src/core"), exports);
@@ -3,7 +3,7 @@ import { DATE_TIME_PROPS } from './utils';
3
3
  import { ToLocalTime } from './ToLocalTime';
4
4
  function pad(n) {
5
5
  if (n < 10) {
6
- return "0" + n;
6
+ return "0".concat(n);
7
7
  }
8
8
  return String(n);
9
9
  }
@@ -107,11 +107,11 @@ export function InitializeDateTimeFormat(dtf, locales, opts, _a) {
107
107
  // @ts-expect-error
108
108
  undefined);
109
109
  var dataLocaleData = localeData[dataLocale];
110
- invariant(!!dataLocaleData, "Missing locale data for " + dataLocale);
110
+ invariant(!!dataLocaleData, "Missing locale data for ".concat(dataLocale));
111
111
  var formats = dataLocaleData.formats[calendar];
112
112
  // UNSPECCED: IMPLEMENTATION DETAILS
113
113
  if (!formats) {
114
- throw new RangeError("Calendar \"" + calendar + "\" is not supported. Try setting \"calendar\" to 1 of the following: " + Object.keys(dataLocaleData.formats).join(', '));
114
+ throw new RangeError("Calendar \"".concat(calendar, "\" is not supported. Try setting \"calendar\" to 1 of the following: ").concat(Object.keys(dataLocaleData.formats).join(', ')));
115
115
  }
116
116
  var formatMatcher = GetOption(options, 'formatMatcher', 'string', ['basic', 'best fit'], 'best fit');
117
117
  var dateStyle = GetOption(options, 'dateStyle', 'string', ['full', 'long', 'medium', 'short'], undefined);
@@ -138,7 +138,7 @@ export function InitializeDateTimeFormat(dtf, locales, opts, _a) {
138
138
  var prop = DATE_TIME_PROPS_1[_i];
139
139
  var p = opt[prop];
140
140
  if (p !== undefined) {
141
- throw new TypeError("Intl.DateTimeFormat can't set option " + prop + " when " + (dateStyle ? 'dateStyle' : 'timeStyle') + " is used");
141
+ throw new TypeError("Intl.DateTimeFormat can't set option ".concat(prop, " when ").concat(dateStyle ? 'dateStyle' : 'timeStyle', " is used"));
142
142
  }
143
143
  }
144
144
  bestFormat = DateTimeStyleFormat(dateStyle, timeStyle, dataLocaleData);
@@ -172,7 +172,7 @@ export function processDateTimePattern(pattern, result) {
172
172
  // Apostrophe-escaped
173
173
  .replace(/'(.*?)'/g, function (_, literal) {
174
174
  literals.push(literal);
175
- return "$$" + (literals.length - 1) + "$$";
175
+ return "$$".concat(literals.length - 1, "$$");
176
176
  })
177
177
  .replace(DATE_TIME_REGEX, function (m) { return matchSkeletonPattern(m, result || {}); });
178
178
  //Restore literals
package/lib/src/core.js CHANGED
@@ -111,7 +111,7 @@ export var DateTimeFormat = function (locales, options) {
111
111
  var internalSlots = getInternalSlots(this);
112
112
  var dataLocale = internalSlots.dataLocale;
113
113
  var dataLocaleData = DateTimeFormat.localeData[dataLocale];
114
- invariant(dataLocaleData !== undefined, "Cannot load locale-dependent data for " + dataLocale + ".");
114
+ invariant(dataLocaleData !== undefined, "Cannot load locale-dependent data for ".concat(dataLocale, "."));
115
115
  /** IMPL END */
116
116
  };
117
117
  // Static properties
package/lib/src/packer.js CHANGED
@@ -8,8 +8,8 @@ export function pack(data) {
8
8
  zone
9
9
  ], data.zones[zone].map(function (_a) {
10
10
  var ts = _a[0], others = _a.slice(1);
11
- return __spreadArray([ts === '' ? '' : ts.toString(36)], others).join(',');
12
- })).join('|');
11
+ return __spreadArray([ts === '' ? '' : ts.toString(36)], others, true).join(',');
12
+ }), true).join('|');
13
13
  }),
14
14
  abbrvs: data.abbrvs.join('|'),
15
15
  offsets: data.offsets.map(function (o) { return o.toString(36); }).join('|'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formatjs/intl-datetimeformat",
3
- "version": "4.2.5",
3
+ "version": "4.2.6",
4
4
  "description": "Intl.DateTimeFormat polyfill",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "homepage": "https://github.com/formatjs/formatjs#readme",
24
24
  "dependencies": {
25
- "@formatjs/ecma402-abstract": "1.10.0",
25
+ "@formatjs/ecma402-abstract": "1.11.0",
26
26
  "@formatjs/intl-localematcher": "0.2.21",
27
27
  "tslib": "^2.1.0"
28
28
  }
package/polyfill-force.js CHANGED
@@ -3,19 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var _1 = require("./");
4
4
  var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
5
5
  var to_locale_string_1 = require("./src/to_locale_string");
6
- ecma402_abstract_1.defineProperty(Intl, 'DateTimeFormat', { value: _1.DateTimeFormat });
7
- ecma402_abstract_1.defineProperty(Date.prototype, 'toLocaleString', {
6
+ (0, ecma402_abstract_1.defineProperty)(Intl, 'DateTimeFormat', { value: _1.DateTimeFormat });
7
+ (0, ecma402_abstract_1.defineProperty)(Date.prototype, 'toLocaleString', {
8
8
  value: function toLocaleString(locales, options) {
9
- return to_locale_string_1.toLocaleString(this, locales, options);
9
+ return (0, to_locale_string_1.toLocaleString)(this, locales, options);
10
10
  },
11
11
  });
12
- ecma402_abstract_1.defineProperty(Date.prototype, 'toLocaleDateString', {
12
+ (0, ecma402_abstract_1.defineProperty)(Date.prototype, 'toLocaleDateString', {
13
13
  value: function toLocaleDateString(locales, options) {
14
- return to_locale_string_1.toLocaleDateString(this, locales, options);
14
+ return (0, to_locale_string_1.toLocaleDateString)(this, locales, options);
15
15
  },
16
16
  });
17
- ecma402_abstract_1.defineProperty(Date.prototype, 'toLocaleTimeString', {
17
+ (0, ecma402_abstract_1.defineProperty)(Date.prototype, 'toLocaleTimeString', {
18
18
  value: function toLocaleTimeString(locales, options) {
19
- return to_locale_string_1.toLocaleTimeString(this, locales, options);
19
+ return (0, to_locale_string_1.toLocaleTimeString)(this, locales, options);
20
20
  },
21
21
  });
package/polyfill.iife.js CHANGED
@@ -8,11 +8,8 @@
8
8
  var __markAsModule = function(target) {
9
9
  return __defProp(target, "__esModule", { value: true });
10
10
  };
11
- var __require = typeof require !== "undefined" ? require : function(x) {
12
- throw new Error('Dynamic require of "' + x + '" is not supported');
13
- };
14
11
  var __commonJS = function(cb, mod2) {
15
- return function __require2() {
12
+ return function __require() {
16
13
  return mod2 || (0, cb[Object.keys(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
17
14
  };
18
15
  };
@@ -91,7 +88,7 @@
91
88
  for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
92
89
  var locale = requestedLocales_1[_i];
93
90
  var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
94
- var availableLocale = BestAvailableLocale_1.BestAvailableLocale(availableLocales, noExtensionLocale);
91
+ var availableLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(availableLocales, noExtensionLocale);
95
92
  if (availableLocale) {
96
93
  result.locale = availableLocale;
97
94
  if (locale !== noExtensionLocale) {
@@ -148,7 +145,7 @@
148
145
  foundLocale = minimizedRequestedLocale;
149
146
  break;
150
147
  }
151
- foundLocale = BestAvailableLocale_1.BestAvailableLocale(minimizedAvailableLocales, maximizedRequestedLocale);
148
+ foundLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(minimizedAvailableLocales, maximizedRequestedLocale);
152
149
  }
153
150
  return {
154
151
  locale: foundLocale && minimizedAvailableLocaleMap[foundLocale] || getDefaultLocale()
@@ -166,9 +163,9 @@
166
163
  exports.UnicodeExtensionValue = void 0;
167
164
  var utils_1 = require_utils();
168
165
  function UnicodeExtensionValue(extension, key) {
169
- utils_1.invariant(key.length === 2, "key must have 2 elements");
166
+ (0, utils_1.invariant)(key.length === 2, "key must have 2 elements");
170
167
  var size = extension.length;
171
- var searchValue = "-" + key + "-";
168
+ var searchValue = "-".concat(key, "-");
172
169
  var pos = extension.indexOf(searchValue);
173
170
  if (pos !== -1) {
174
171
  var start = pos + 4;
@@ -195,7 +192,7 @@
195
192
  }
196
193
  return extension.slice(start, end);
197
194
  }
198
- searchValue = "-" + key;
195
+ searchValue = "-".concat(key);
199
196
  pos = extension.indexOf(searchValue);
200
197
  if (pos !== -1 && pos + 3 === size) {
201
198
  return "";
@@ -220,40 +217,40 @@
220
217
  var matcher = options.localeMatcher;
221
218
  var r;
222
219
  if (matcher === "lookup") {
223
- r = LookupMatcher_1.LookupMatcher(availableLocales, requestedLocales, getDefaultLocale);
220
+ r = (0, LookupMatcher_1.LookupMatcher)(availableLocales, requestedLocales, getDefaultLocale);
224
221
  } else {
225
- r = BestFitMatcher_1.BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale);
222
+ r = (0, BestFitMatcher_1.BestFitMatcher)(availableLocales, requestedLocales, getDefaultLocale);
226
223
  }
227
224
  var foundLocale = r.locale;
228
225
  var result = { locale: "", dataLocale: foundLocale };
229
226
  var supportedExtension = "-u";
230
227
  for (var _i = 0, relevantExtensionKeys_1 = relevantExtensionKeys; _i < relevantExtensionKeys_1.length; _i++) {
231
228
  var key = relevantExtensionKeys_1[_i];
232
- utils_1.invariant(foundLocale in localeData, "Missing locale data for " + foundLocale);
229
+ (0, utils_1.invariant)(foundLocale in localeData, "Missing locale data for ".concat(foundLocale));
233
230
  var foundLocaleData = localeData[foundLocale];
234
- utils_1.invariant(typeof foundLocaleData === "object" && foundLocaleData !== null, "locale data " + key + " must be an object");
231
+ (0, utils_1.invariant)(typeof foundLocaleData === "object" && foundLocaleData !== null, "locale data ".concat(key, " must be an object"));
235
232
  var keyLocaleData = foundLocaleData[key];
236
- utils_1.invariant(Array.isArray(keyLocaleData), "keyLocaleData for " + key + " must be an array");
233
+ (0, utils_1.invariant)(Array.isArray(keyLocaleData), "keyLocaleData for ".concat(key, " must be an array"));
237
234
  var value = keyLocaleData[0];
238
- utils_1.invariant(typeof value === "string" || value === null, "value must be string or null but got " + typeof value + " in key " + key);
235
+ (0, utils_1.invariant)(typeof value === "string" || value === null, "value must be string or null but got ".concat(typeof value, " in key ").concat(key));
239
236
  var supportedExtensionAddition = "";
240
237
  if (r.extension) {
241
- var requestedValue = UnicodeExtensionValue_1.UnicodeExtensionValue(r.extension, key);
238
+ var requestedValue = (0, UnicodeExtensionValue_1.UnicodeExtensionValue)(r.extension, key);
242
239
  if (requestedValue !== void 0) {
243
240
  if (requestedValue !== "") {
244
241
  if (~keyLocaleData.indexOf(requestedValue)) {
245
242
  value = requestedValue;
246
- supportedExtensionAddition = "-" + key + "-" + value;
243
+ supportedExtensionAddition = "-".concat(key, "-").concat(value);
247
244
  }
248
245
  } else if (~requestedValue.indexOf("true")) {
249
246
  value = "true";
250
- supportedExtensionAddition = "-" + key;
247
+ supportedExtensionAddition = "-".concat(key);
251
248
  }
252
249
  }
253
250
  }
254
251
  if (key in options) {
255
252
  var optionsValue = options[key];
256
- utils_1.invariant(typeof optionsValue === "string" || typeof optionsValue === "undefined" || optionsValue === null, "optionsValue must be String, Undefined or Null");
253
+ (0, utils_1.invariant)(typeof optionsValue === "string" || typeof optionsValue === "undefined" || optionsValue === null, "optionsValue must be String, Undefined or Null");
257
254
  if (~keyLocaleData.indexOf(optionsValue)) {
258
255
  if (optionsValue !== value) {
259
256
  value = optionsValue;
@@ -295,7 +292,7 @@
295
292
  for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
296
293
  var locale = requestedLocales_1[_i];
297
294
  var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
298
- var availableLocale = BestAvailableLocale_1.BestAvailableLocale(availableLocales, noExtensionLocale);
295
+ var availableLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(availableLocales, noExtensionLocale);
299
296
  if (availableLocale) {
300
297
  subset.push(availableLocale);
301
298
  }
@@ -318,7 +315,7 @@
318
315
  all.add(l);
319
316
  return all;
320
317
  }, new Set());
321
- return ResolveLocale_1.ResolveLocale(locales, requestedLocales, {
318
+ return (0, ResolveLocale_1.ResolveLocale)(locales, requestedLocales, {
322
319
  localeMatcher: (opts === null || opts === void 0 ? void 0 : opts.algorithm) || "best fit"
323
320
  }, [], {}, function() {
324
321
  return defaultLocale;
@@ -657,7 +654,7 @@
657
654
  if (val !== void 0) {
658
655
  val = Number(val);
659
656
  if (isNaN(val) || val < min || val > max) {
660
- throw new RangeError(val + " is outside of range [" + min + ", " + max + "]");
657
+ throw new RangeError("".concat(val, " is outside of range [").concat(min, ", ").concat(max, "]"));
661
658
  }
662
659
  return Math.floor(val);
663
660
  }
@@ -689,7 +686,7 @@
689
686
  if (values !== void 0 && !values.filter(function(val) {
690
687
  return val == value;
691
688
  }).length) {
692
- throw new RangeError(value + " is not within " + values.join(", "));
689
+ throw new RangeError("".concat(value, " is not within ").concat(values.join(", ")));
693
690
  }
694
691
  return value;
695
692
  }
@@ -788,8 +785,8 @@
788
785
  var S_UNICODE_REGEX = /[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20BF\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC1\uFDFC\uFDFD\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDE8\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEE0-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF73\uDF80-\uDFD8\uDFE0-\uDFEB]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDD78\uDD7A-\uDDCB\uDDCD-\uDE53\uDE60-\uDE6D\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6\uDF00-\uDF92\uDF94-\uDFCA]/;
789
786
 
790
787
  // bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/NumberFormat/format_to_parts.js
791
- var CARET_S_UNICODE_REGEX = new RegExp("^" + S_UNICODE_REGEX.source);
792
- var S_DOLLAR_UNICODE_REGEX = new RegExp(S_UNICODE_REGEX.source + "$");
788
+ var CARET_S_UNICODE_REGEX = new RegExp("^".concat(S_UNICODE_REGEX.source));
789
+ var S_DOLLAR_UNICODE_REGEX = new RegExp("".concat(S_UNICODE_REGEX.source, "$"));
793
790
 
794
791
  // bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/NumberFormat/InitializeNumberFormat.js
795
792
  var import_intl_localematcher = __toModule(require_intl_localematcher());
@@ -803,7 +800,7 @@
803
800
  var length = pattern.length;
804
801
  while (beginIndex < pattern.length && beginIndex > -1) {
805
802
  endIndex = pattern.indexOf("}", beginIndex);
806
- invariant(endIndex > beginIndex, "Invalid pattern " + pattern);
803
+ invariant(endIndex > beginIndex, "Invalid pattern ".concat(pattern));
807
804
  if (beginIndex > nextIndex) {
808
805
  result.push({
809
806
  type: "literal",
@@ -1087,7 +1084,7 @@
1087
1084
  // bazel-out/darwin-fastbuild/bin/packages/intl-datetimeformat/lib/src/abstract/FormatDateTimePattern.js
1088
1085
  function pad(n) {
1089
1086
  if (n < 10) {
1090
- return "0" + n;
1087
+ return "0".concat(n);
1091
1088
  }
1092
1089
  return String(n);
1093
1090
  }
@@ -1440,7 +1437,7 @@
1440
1437
  var literals = [];
1441
1438
  var pattern12 = pattern.replace(/'{2}/g, "{apostrophe}").replace(/'(.*?)'/g, function(_, literal) {
1442
1439
  literals.push(literal);
1443
- return "$$" + (literals.length - 1) + "$$";
1440
+ return "$$".concat(literals.length - 1, "$$");
1444
1441
  }).replace(DATE_TIME_REGEX, function(m) {
1445
1442
  return matchSkeletonPattern(m, result || {});
1446
1443
  });
@@ -1818,10 +1815,10 @@
1818
1815
  opt.timeZoneName = GetOption(options, "timeZoneName", "string", ["short", "long"], void 0);
1819
1816
  opt.fractionalSecondDigits = GetNumberOption(options, "fractionalSecondDigits", 1, 3, void 0);
1820
1817
  var dataLocaleData = localeData[dataLocale];
1821
- invariant(!!dataLocaleData, "Missing locale data for " + dataLocale);
1818
+ invariant(!!dataLocaleData, "Missing locale data for ".concat(dataLocale));
1822
1819
  var formats = dataLocaleData.formats[calendar];
1823
1820
  if (!formats) {
1824
- throw new RangeError('Calendar "' + calendar + '" is not supported. Try setting "calendar" to 1 of the following: ' + Object.keys(dataLocaleData.formats).join(", "));
1821
+ throw new RangeError('Calendar "'.concat(calendar, '" is not supported. Try setting "calendar" to 1 of the following: ').concat(Object.keys(dataLocaleData.formats).join(", ")));
1825
1822
  }
1826
1823
  var formatMatcher = GetOption(options, "formatMatcher", "string", ["basic", "best fit"], "best fit");
1827
1824
  var dateStyle = GetOption(options, "dateStyle", "string", ["full", "long", "medium", "short"], void 0);
@@ -1844,7 +1841,7 @@
1844
1841
  var prop = DATE_TIME_PROPS_1[_i];
1845
1842
  var p = opt[prop];
1846
1843
  if (p !== void 0) {
1847
- throw new TypeError("Intl.DateTimeFormat can't set option " + prop + " when " + (dateStyle ? "dateStyle" : "timeStyle") + " is used");
1844
+ throw new TypeError("Intl.DateTimeFormat can't set option ".concat(prop, " when ").concat(dateStyle ? "dateStyle" : "timeStyle", " is used"));
1848
1845
  }
1849
1846
  }
1850
1847
  bestFormat = DateTimeStyleFormat(dateStyle, timeStyle, dataLocaleData);
@@ -2109,7 +2106,7 @@
2109
2106
  var internalSlots = getInternalSlots(this);
2110
2107
  var dataLocale = internalSlots.dataLocale;
2111
2108
  var dataLocaleData = DateTimeFormat.localeData[dataLocale];
2112
- invariant(dataLocaleData !== void 0, "Cannot load locale-dependent data for " + dataLocale + ".");
2109
+ invariant(dataLocaleData !== void 0, "Cannot load locale-dependent data for ".concat(dataLocale, "."));
2113
2110
  };
2114
2111
  defineProperty(DateTimeFormat, "supportedLocalesOf", {
2115
2112
  value: function supportedLocalesOf(locales, options) {
package/polyfill.js CHANGED
@@ -4,21 +4,21 @@ var _1 = require("./");
4
4
  var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
5
5
  var should_polyfill_1 = require("./should-polyfill");
6
6
  var to_locale_string_1 = require("./src/to_locale_string");
7
- if (should_polyfill_1.shouldPolyfill()) {
8
- ecma402_abstract_1.defineProperty(Intl, 'DateTimeFormat', { value: _1.DateTimeFormat });
9
- ecma402_abstract_1.defineProperty(Date.prototype, 'toLocaleString', {
7
+ if ((0, should_polyfill_1.shouldPolyfill)()) {
8
+ (0, ecma402_abstract_1.defineProperty)(Intl, 'DateTimeFormat', { value: _1.DateTimeFormat });
9
+ (0, ecma402_abstract_1.defineProperty)(Date.prototype, 'toLocaleString', {
10
10
  value: function toLocaleString(locales, options) {
11
- return to_locale_string_1.toLocaleString(this, locales, options);
11
+ return (0, to_locale_string_1.toLocaleString)(this, locales, options);
12
12
  },
13
13
  });
14
- ecma402_abstract_1.defineProperty(Date.prototype, 'toLocaleDateString', {
14
+ (0, ecma402_abstract_1.defineProperty)(Date.prototype, 'toLocaleDateString', {
15
15
  value: function toLocaleDateString(locales, options) {
16
- return to_locale_string_1.toLocaleDateString(this, locales, options);
16
+ return (0, to_locale_string_1.toLocaleDateString)(this, locales, options);
17
17
  },
18
18
  });
19
- ecma402_abstract_1.defineProperty(Date.prototype, 'toLocaleTimeString', {
19
+ (0, ecma402_abstract_1.defineProperty)(Date.prototype, 'toLocaleTimeString', {
20
20
  value: function toLocaleTimeString(locales, options) {
21
- return to_locale_string_1.toLocaleTimeString(this, locales, options);
21
+ return (0, to_locale_string_1.toLocaleTimeString)(this, locales, options);
22
22
  },
23
23
  });
24
24
  }
@@ -12,7 +12,7 @@ var utils_1 = require("./utils");
12
12
  function BasicFormatMatcher(options, formats) {
13
13
  var bestScore = -Infinity;
14
14
  var bestFormat = formats[0];
15
- ecma402_abstract_1.invariant(Array.isArray(formats), 'formats should be a list of things');
15
+ (0, ecma402_abstract_1.invariant)(Array.isArray(formats), 'formats should be a list of things');
16
16
  for (var _i = 0, formats_1 = formats; _i < formats_1.length; _i++) {
17
17
  var format = formats_1[_i];
18
18
  var score = 0;
@@ -56,6 +56,6 @@ function BasicFormatMatcher(options, formats) {
56
56
  bestFormat = format;
57
57
  }
58
58
  }
59
- return tslib_1.__assign({}, bestFormat);
59
+ return (0, tslib_1.__assign)({}, bestFormat);
60
60
  }
61
61
  exports.BasicFormatMatcher = BasicFormatMatcher;
@@ -71,7 +71,7 @@ exports.bestFitFormatMatcherScore = bestFitFormatMatcherScore;
71
71
  function BestFitFormatMatcher(options, formats) {
72
72
  var bestScore = -Infinity;
73
73
  var bestFormat = formats[0];
74
- ecma402_abstract_1.invariant(Array.isArray(formats), 'formats should be a list of things');
74
+ (0, ecma402_abstract_1.invariant)(Array.isArray(formats), 'formats should be a list of things');
75
75
  for (var _i = 0, formats_1 = formats; _i < formats_1.length; _i++) {
76
76
  var format = formats_1[_i];
77
77
  var score = bestFitFormatMatcherScore(options, format);
@@ -80,9 +80,9 @@ function BestFitFormatMatcher(options, formats) {
80
80
  bestFormat = format;
81
81
  }
82
82
  }
83
- var skeletonFormat = tslib_1.__assign({}, bestFormat);
83
+ var skeletonFormat = (0, tslib_1.__assign)({}, bestFormat);
84
84
  var patternFormat = { rawPattern: bestFormat.rawPattern };
85
- skeleton_1.processDateTimePattern(bestFormat.rawPattern, patternFormat);
85
+ (0, skeleton_1.processDateTimePattern)(bestFormat.rawPattern, patternFormat);
86
86
  // Kinda following https://github.com/unicode-org/icu/blob/dd50e38f459d84e9bf1b0c618be8483d318458ad/icu4j/main/classes/core/src/com/ibm/icu/text/DateTimePatternGenerator.java
87
87
  // Method adjustFieldTypes
88
88
  for (var prop in skeletonFormat) {
@@ -5,14 +5,14 @@ var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
5
5
  function DateTimeStyleFormat(dateStyle, timeStyle, dataLocaleData) {
6
6
  var dateFormat, timeFormat;
7
7
  if (timeStyle !== undefined) {
8
- ecma402_abstract_1.invariant(timeStyle === 'full' ||
8
+ (0, ecma402_abstract_1.invariant)(timeStyle === 'full' ||
9
9
  timeStyle === 'long' ||
10
10
  timeStyle === 'medium' ||
11
11
  timeStyle === 'short', 'invalid timeStyle');
12
12
  timeFormat = dataLocaleData.timeFormat[timeStyle];
13
13
  }
14
14
  if (dateStyle !== undefined) {
15
- ecma402_abstract_1.invariant(dateStyle === 'full' ||
15
+ (0, ecma402_abstract_1.invariant)(dateStyle === 'full' ||
16
16
  dateStyle === 'long' ||
17
17
  dateStyle === 'medium' ||
18
18
  dateStyle === 'short', 'invalid dateStyle');
@@ -48,7 +48,7 @@ function DateTimeStyleFormat(dateStyle, timeStyle, dataLocaleData) {
48
48
  if (timeStyle !== undefined) {
49
49
  return timeFormat;
50
50
  }
51
- ecma402_abstract_1.invariant(dateStyle !== undefined, 'dateStyle should not be undefined');
51
+ (0, ecma402_abstract_1.invariant)(dateStyle !== undefined, 'dateStyle should not be undefined');
52
52
  return dateFormat;
53
53
  }
54
54
  exports.DateTimeStyleFormat = DateTimeStyleFormat;
@@ -8,7 +8,7 @@ var PartitionDateTimePattern_1 = require("./PartitionDateTimePattern");
8
8
  * @param x
9
9
  */
10
10
  function FormatDateTime(dtf, x, implDetails) {
11
- var parts = PartitionDateTimePattern_1.PartitionDateTimePattern(dtf, x, implDetails);
11
+ var parts = (0, PartitionDateTimePattern_1.PartitionDateTimePattern)(dtf, x, implDetails);
12
12
  var result = '';
13
13
  for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
14
14
  var part = parts_1[_i];
@@ -6,7 +6,7 @@ var utils_1 = require("./utils");
6
6
  var ToLocalTime_1 = require("./ToLocalTime");
7
7
  function pad(n) {
8
8
  if (n < 10) {
9
- return "0" + n;
9
+ return "0".concat(n);
10
10
  }
11
11
  return String(n);
12
12
  }
@@ -39,7 +39,7 @@ function offsetToGmtString(gmtFormat, hourFormat, offsetInMs, style) {
39
39
  */
40
40
  function FormatDateTimePattern(dtf, patternParts, x, _a) {
41
41
  var getInternalSlots = _a.getInternalSlots, localeData = _a.localeData, getDefaultTimeZone = _a.getDefaultTimeZone, tzData = _a.tzData;
42
- x = ecma402_abstract_1.TimeClip(x);
42
+ x = (0, ecma402_abstract_1.TimeClip)(x);
43
43
  /** IMPL START */
44
44
  var internalSlots = getInternalSlots(dtf);
45
45
  var dataLocale = internalSlots.dataLocale;
@@ -61,7 +61,7 @@ function FormatDateTimePattern(dtf, patternParts, x, _a) {
61
61
  nf3Options.useGrouping = false;
62
62
  nf3 = new Intl.NumberFormat(locale, nf3Options);
63
63
  }
64
- var tm = ToLocalTime_1.ToLocalTime(x,
64
+ var tm = (0, ToLocalTime_1.ToLocalTime)(x,
65
65
  // @ts-ignore
66
66
  internalSlots.calendar, internalSlots.timeZone, { tzData: tzData });
67
67
  var result = [];
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FormatDateTimeRange = void 0;
4
4
  var PartitionDateTimeRangePattern_1 = require("./PartitionDateTimeRangePattern");
5
5
  function FormatDateTimeRange(dtf, x, y, implDetails) {
6
- var parts = PartitionDateTimeRangePattern_1.PartitionDateTimeRangePattern(dtf, x, y, implDetails);
6
+ var parts = (0, PartitionDateTimeRangePattern_1.PartitionDateTimeRangePattern)(dtf, x, y, implDetails);
7
7
  var result = '';
8
8
  for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
9
9
  var part = parts_1[_i];
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FormatDateTimeRangeToParts = void 0;
4
4
  var PartitionDateTimeRangePattern_1 = require("./PartitionDateTimeRangePattern");
5
5
  function FormatDateTimeRangeToParts(dtf, x, y, implDetails) {
6
- var parts = PartitionDateTimeRangePattern_1.PartitionDateTimeRangePattern(dtf, x, y, implDetails);
6
+ var parts = (0, PartitionDateTimeRangePattern_1.PartitionDateTimeRangePattern)(dtf, x, y, implDetails);
7
7
  var result = new Array(0);
8
8
  for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
9
9
  var part = parts_1[_i];
@@ -11,8 +11,8 @@ var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
11
11
  * @param implDetails
12
12
  */
13
13
  function FormatDateTimeToParts(dtf, x, implDetails) {
14
- var parts = PartitionDateTimePattern_1.PartitionDateTimePattern(dtf, x, implDetails);
15
- var result = ecma402_abstract_1.ArrayCreate(0);
14
+ var parts = (0, PartitionDateTimePattern_1.PartitionDateTimePattern)(dtf, x, implDetails);
15
+ var result = (0, ecma402_abstract_1.ArrayCreate)(0);
16
16
  for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {
17
17
  var part = parts_1[_i];
18
18
  result.push({