@formatjs/intl-datetimeformat 6.17.3 → 6.17.4

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/lib/polyfill.js CHANGED
@@ -6,6 +6,10 @@ if (shouldPolyfill()) {
6
6
  defineProperty(Intl, 'DateTimeFormat', { value: DateTimeFormat });
7
7
  defineProperty(Date.prototype, 'toLocaleString', {
8
8
  value: function toLocaleString(locales, options) {
9
+ if (options === void 0) { options = {
10
+ dateStyle: 'short',
11
+ timeStyle: 'medium',
12
+ }; }
9
13
  try {
10
14
  return _toLocaleString(this, locales, options);
11
15
  }
@@ -16,6 +20,9 @@ if (shouldPolyfill()) {
16
20
  });
17
21
  defineProperty(Date.prototype, 'toLocaleDateString', {
18
22
  value: function toLocaleDateString(locales, options) {
23
+ if (options === void 0) { options = {
24
+ dateStyle: 'short',
25
+ }; }
19
26
  try {
20
27
  return _toLocaleDateString(this, locales, options);
21
28
  }
@@ -26,6 +33,9 @@ if (shouldPolyfill()) {
26
33
  });
27
34
  defineProperty(Date.prototype, 'toLocaleTimeString', {
28
35
  value: function toLocaleTimeString(locales, options) {
36
+ if (options === void 0) { options = {
37
+ timeStyle: 'medium',
38
+ }; }
29
39
  try {
30
40
  return _toLocaleTimeString(this, locales, options);
31
41
  }
package/package.json CHANGED
@@ -1,34 +1,29 @@
1
1
  {
2
2
  "name": "@formatjs/intl-datetimeformat",
3
- "version": "6.17.3",
4
3
  "description": "Intl.DateTimeFormat polyfill",
5
- "main": "index.js",
4
+ "version": "6.17.4",
5
+ "license": "MIT",
6
+ "author": "Long Ho <holevietlong@gmail.com>",
6
7
  "types": "index.d.ts",
7
- "repository": {
8
- "type": "git",
9
- "url": "git+https://github.com/formatjs/formatjs.git"
8
+ "dependencies": {
9
+ "decimal.js": "^10.4.3",
10
+ "tslib": "^2.8.0",
11
+ "@formatjs/ecma402-abstract": "2.3.4",
12
+ "@formatjs/intl-localematcher": "0.6.1"
10
13
  },
14
+ "devDependencies": {
15
+ "@formatjs/intl-getcanonicallocales": "2.5.5",
16
+ "@formatjs/intl-locale": "4.2.11"
17
+ },
18
+ "bugs": "https://github.com/formatjs/formatjs/issues",
19
+ "homepage": "https://github.com/formatjs/formatjs#readme",
11
20
  "keywords": [
21
+ "datetimeformat",
22
+ "formatjs",
12
23
  "i18n",
13
24
  "intl",
14
- "polyfill",
15
- "datetimeformat",
16
- "formatjs"
25
+ "polyfill"
17
26
  ],
18
- "author": "Long Ho <holevietlong@gmail.com>",
19
- "license": "MIT",
20
- "bugs": {
21
- "url": "https://github.com/formatjs/formatjs/issues"
22
- },
23
- "homepage": "https://github.com/formatjs/formatjs#readme",
24
- "dependencies": {
25
- "decimal.js": "10",
26
- "tslib": "2",
27
- "@formatjs/ecma402-abstract": "2.3.3",
28
- "@formatjs/intl-localematcher": "0.6.0"
29
- },
30
- "devDependencies": {
31
- "@formatjs/intl-locale": "4.2.10",
32
- "@formatjs/intl-getcanonicallocales": "2.5.4"
33
- }
27
+ "main": "index.js",
28
+ "repository": "formatjs/formatjs.git"
34
29
  }
package/polyfill.iife.js CHANGED
@@ -52,7 +52,7 @@
52
52
  return ianaTimeZone;
53
53
  }
54
54
 
55
- // node_modules/.aspect_rules_js/decimal.js@10.4.3/node_modules/decimal.js/decimal.mjs
55
+ // node_modules/.aspect_rules_js/decimal.js@10.5.0/node_modules/decimal.js/decimal.mjs
56
56
  var EXP_LIMIT = 9e15;
57
57
  var MAX_DIGITS = 1e9;
58
58
  var NUMERALS = "0123456789abcdef";
@@ -344,7 +344,7 @@
344
344
  return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
345
345
  };
346
346
  P.inverseCosine = P.acos = function() {
347
- var halfPi, x = this, Ctor = x.constructor, k = x.abs().cmp(1), pr = Ctor.precision, rm = Ctor.rounding;
347
+ var x = this, Ctor = x.constructor, k = x.abs().cmp(1), pr = Ctor.precision, rm = Ctor.rounding;
348
348
  if (k !== -1) {
349
349
  return k === 0 ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0) : new Ctor(NaN);
350
350
  }
@@ -352,11 +352,10 @@
352
352
  return getPi(Ctor, pr + 4, rm).times(0.5);
353
353
  Ctor.precision = pr + 6;
354
354
  Ctor.rounding = 1;
355
- x = x.asin();
356
- halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
355
+ x = new Ctor(1).minus(x).div(x.plus(1)).sqrt().atan();
357
356
  Ctor.precision = pr;
358
357
  Ctor.rounding = rm;
359
- return halfPi.minus(x);
358
+ return x.times(2);
360
359
  };
361
360
  P.inverseHyperbolicCosine = P.acosh = function() {
362
361
  var pr, rm, x = this, Ctor = x.constructor;
@@ -1568,14 +1567,16 @@
1568
1567
  function isOdd(n) {
1569
1568
  return n.d[n.d.length - 1] & 1;
1570
1569
  }
1571
- function maxOrMin(Ctor, args, ltgt) {
1572
- var y, x = new Ctor(args[0]), i = 0;
1570
+ function maxOrMin(Ctor, args, n) {
1571
+ var k, y, x = new Ctor(args[0]), i = 0;
1573
1572
  for (; ++i < args.length; ) {
1574
1573
  y = new Ctor(args[i]);
1575
1574
  if (!y.s) {
1576
1575
  x = y;
1577
1576
  break;
1578
- } else if (x[ltgt](y)) {
1577
+ }
1578
+ k = x.cmp(y);
1579
+ if (k === n || k === 0 && x.s === n) {
1579
1580
  x = y;
1580
1581
  }
1581
1582
  }
@@ -2157,7 +2158,8 @@
2157
2158
  x.d = [v];
2158
2159
  }
2159
2160
  return;
2160
- } else if (v * 0 !== 0) {
2161
+ }
2162
+ if (v * 0 !== 0) {
2161
2163
  if (!v)
2162
2164
  x.s = NaN;
2163
2165
  x.e = NaN;
@@ -2165,18 +2167,28 @@
2165
2167
  return;
2166
2168
  }
2167
2169
  return parseDecimal(x, v.toString());
2168
- } else if (t !== "string") {
2169
- throw Error(invalidArgument + v);
2170
2170
  }
2171
- if ((i2 = v.charCodeAt(0)) === 45) {
2172
- v = v.slice(1);
2173
- x.s = -1;
2174
- } else {
2175
- if (i2 === 43)
2171
+ if (t === "string") {
2172
+ if ((i2 = v.charCodeAt(0)) === 45) {
2176
2173
  v = v.slice(1);
2177
- x.s = 1;
2174
+ x.s = -1;
2175
+ } else {
2176
+ if (i2 === 43)
2177
+ v = v.slice(1);
2178
+ x.s = 1;
2179
+ }
2180
+ return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
2181
+ }
2182
+ if (t === "bigint") {
2183
+ if (v < 0) {
2184
+ v = -v;
2185
+ x.s = -1;
2186
+ } else {
2187
+ x.s = 1;
2188
+ }
2189
+ return parseDecimal(x, v.toString());
2178
2190
  }
2179
- return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
2191
+ throw Error(invalidArgument + v);
2180
2192
  }
2181
2193
  Decimal2.prototype = P;
2182
2194
  Decimal2.ROUND_UP = 0;
@@ -2286,10 +2298,10 @@
2286
2298
  return new this(x).log(10);
2287
2299
  }
2288
2300
  function max() {
2289
- return maxOrMin(this, arguments, "lt");
2301
+ return maxOrMin(this, arguments, -1);
2290
2302
  }
2291
2303
  function min() {
2292
- return maxOrMin(this, arguments, "gt");
2304
+ return maxOrMin(this, arguments, 1);
2293
2305
  }
2294
2306
  function mod(x, y) {
2295
2307
  return new this(x).mod(y);
@@ -9304,7 +9316,10 @@
9304
9316
  if (shouldPolyfill()) {
9305
9317
  defineProperty(Intl, "DateTimeFormat", { value: DateTimeFormat4 });
9306
9318
  defineProperty(Date.prototype, "toLocaleString", {
9307
- value: function toLocaleString2(locales, options) {
9319
+ value: function toLocaleString2(locales, options = {
9320
+ dateStyle: "short",
9321
+ timeStyle: "medium"
9322
+ }) {
9308
9323
  try {
9309
9324
  return toLocaleString(this, locales, options);
9310
9325
  } catch (error) {
@@ -9313,7 +9328,9 @@
9313
9328
  }
9314
9329
  });
9315
9330
  defineProperty(Date.prototype, "toLocaleDateString", {
9316
- value: function toLocaleDateString2(locales, options) {
9331
+ value: function toLocaleDateString2(locales, options = {
9332
+ dateStyle: "short"
9333
+ }) {
9317
9334
  try {
9318
9335
  return toLocaleDateString(this, locales, options);
9319
9336
  } catch (error) {
@@ -9322,7 +9339,9 @@
9322
9339
  }
9323
9340
  });
9324
9341
  defineProperty(Date.prototype, "toLocaleTimeString", {
9325
- value: function toLocaleTimeString2(locales, options) {
9342
+ value: function toLocaleTimeString2(locales, options = {
9343
+ timeStyle: "medium"
9344
+ }) {
9326
9345
  try {
9327
9346
  return toLocaleTimeString(this, locales, options);
9328
9347
  } catch (error) {
@@ -9336,10 +9355,10 @@
9336
9355
 
9337
9356
  decimal.js/decimal.mjs:
9338
9357
  (*!
9339
- * decimal.js v10.4.3
9358
+ * decimal.js v10.5.0
9340
9359
  * An arbitrary-precision Decimal type for JavaScript.
9341
9360
  * https://github.com/MikeMcl/decimal.js
9342
- * Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
9361
+ * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
9343
9362
  * MIT Licence
9344
9363
  *)
9345
9364
  */
package/polyfill.js CHANGED
@@ -8,6 +8,10 @@ if ((0, should_polyfill_1.shouldPolyfill)()) {
8
8
  (0, ecma402_abstract_1.defineProperty)(Intl, 'DateTimeFormat', { value: _1.DateTimeFormat });
9
9
  (0, ecma402_abstract_1.defineProperty)(Date.prototype, 'toLocaleString', {
10
10
  value: function toLocaleString(locales, options) {
11
+ if (options === void 0) { options = {
12
+ dateStyle: 'short',
13
+ timeStyle: 'medium',
14
+ }; }
11
15
  try {
12
16
  return (0, to_locale_string_1.toLocaleString)(this, locales, options);
13
17
  }
@@ -18,6 +22,9 @@ if ((0, should_polyfill_1.shouldPolyfill)()) {
18
22
  });
19
23
  (0, ecma402_abstract_1.defineProperty)(Date.prototype, 'toLocaleDateString', {
20
24
  value: function toLocaleDateString(locales, options) {
25
+ if (options === void 0) { options = {
26
+ dateStyle: 'short',
27
+ }; }
21
28
  try {
22
29
  return (0, to_locale_string_1.toLocaleDateString)(this, locales, options);
23
30
  }
@@ -28,6 +35,9 @@ if ((0, should_polyfill_1.shouldPolyfill)()) {
28
35
  });
29
36
  (0, ecma402_abstract_1.defineProperty)(Date.prototype, 'toLocaleTimeString', {
30
37
  value: function toLocaleTimeString(locales, options) {
38
+ if (options === void 0) { options = {
39
+ timeStyle: 'medium',
40
+ }; }
31
41
  try {
32
42
  return (0, to_locale_string_1.toLocaleTimeString)(this, locales, options);
33
43
  }