@formatjs/intl-datetimeformat 5.0.0 → 6.0.1

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,17 +6,32 @@ if (shouldPolyfill()) {
6
6
  defineProperty(Intl, 'DateTimeFormat', { value: DateTimeFormat });
7
7
  defineProperty(Date.prototype, 'toLocaleString', {
8
8
  value: function toLocaleString(locales, options) {
9
- return _toLocaleString(this, locales, options);
9
+ try {
10
+ return _toLocaleString(this, locales, options);
11
+ }
12
+ catch (error) {
13
+ return 'Invalid Date';
14
+ }
10
15
  },
11
16
  });
12
17
  defineProperty(Date.prototype, 'toLocaleDateString', {
13
18
  value: function toLocaleDateString(locales, options) {
14
- return _toLocaleDateString(this, locales, options);
19
+ try {
20
+ return _toLocaleDateString(this, locales, options);
21
+ }
22
+ catch (error) {
23
+ return 'Invalid Date';
24
+ }
15
25
  },
16
26
  });
17
27
  defineProperty(Date.prototype, 'toLocaleTimeString', {
18
28
  value: function toLocaleTimeString(locales, options) {
19
- return _toLocaleTimeString(this, locales, options);
29
+ try {
30
+ return _toLocaleTimeString(this, locales, options);
31
+ }
32
+ catch (error) {
33
+ return 'Invalid Date';
34
+ }
20
35
  },
21
36
  });
22
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formatjs/intl-datetimeformat",
3
- "version": "5.0.0",
3
+ "version": "6.0.1",
4
4
  "description": "Intl.DateTimeFormat polyfill",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -22,8 +22,8 @@
22
22
  },
23
23
  "homepage": "https://github.com/formatjs/formatjs#readme",
24
24
  "dependencies": {
25
- "@formatjs/ecma402-abstract": "1.11.3",
26
- "@formatjs/intl-localematcher": "0.2.24",
27
- "tslib": "^2.1.0"
25
+ "@formatjs/ecma402-abstract": "1.11.6",
26
+ "@formatjs/intl-localematcher": "0.2.27",
27
+ "tslib": "2.4.0"
28
28
  }
29
29
  }