@formatjs/intl-datetimeformat 5.0.1 → 5.0.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.
- package/lib/polyfill.js +18 -3
- package/package.json +1 -1
- package/polyfill.iife.js +15 -3
- package/polyfill.js +18 -3
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
package/polyfill.iife.js
CHANGED
|
@@ -2165,17 +2165,29 @@
|
|
|
2165
2165
|
defineProperty(Intl, "DateTimeFormat", { value: DateTimeFormat });
|
|
2166
2166
|
defineProperty(Date.prototype, "toLocaleString", {
|
|
2167
2167
|
value: function toLocaleString2(locales, options) {
|
|
2168
|
-
|
|
2168
|
+
try {
|
|
2169
|
+
return toLocaleString(this, locales, options);
|
|
2170
|
+
} catch (error) {
|
|
2171
|
+
return "Invalid Date";
|
|
2172
|
+
}
|
|
2169
2173
|
}
|
|
2170
2174
|
});
|
|
2171
2175
|
defineProperty(Date.prototype, "toLocaleDateString", {
|
|
2172
2176
|
value: function toLocaleDateString2(locales, options) {
|
|
2173
|
-
|
|
2177
|
+
try {
|
|
2178
|
+
return toLocaleDateString(this, locales, options);
|
|
2179
|
+
} catch (error) {
|
|
2180
|
+
return "Invalid Date";
|
|
2181
|
+
}
|
|
2174
2182
|
}
|
|
2175
2183
|
});
|
|
2176
2184
|
defineProperty(Date.prototype, "toLocaleTimeString", {
|
|
2177
2185
|
value: function toLocaleTimeString2(locales, options) {
|
|
2178
|
-
|
|
2186
|
+
try {
|
|
2187
|
+
return toLocaleTimeString(this, locales, options);
|
|
2188
|
+
} catch (error) {
|
|
2189
|
+
return "Invalid Date";
|
|
2190
|
+
}
|
|
2179
2191
|
}
|
|
2180
2192
|
});
|
|
2181
2193
|
}
|
package/polyfill.js
CHANGED
|
@@ -8,17 +8,32 @@ 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
|
-
|
|
11
|
+
try {
|
|
12
|
+
return (0, to_locale_string_1.toLocaleString)(this, locales, options);
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
return 'Invalid Date';
|
|
16
|
+
}
|
|
12
17
|
},
|
|
13
18
|
});
|
|
14
19
|
(0, ecma402_abstract_1.defineProperty)(Date.prototype, 'toLocaleDateString', {
|
|
15
20
|
value: function toLocaleDateString(locales, options) {
|
|
16
|
-
|
|
21
|
+
try {
|
|
22
|
+
return (0, to_locale_string_1.toLocaleDateString)(this, locales, options);
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
return 'Invalid Date';
|
|
26
|
+
}
|
|
17
27
|
},
|
|
18
28
|
});
|
|
19
29
|
(0, ecma402_abstract_1.defineProperty)(Date.prototype, 'toLocaleTimeString', {
|
|
20
30
|
value: function toLocaleTimeString(locales, options) {
|
|
21
|
-
|
|
31
|
+
try {
|
|
32
|
+
return (0, to_locale_string_1.toLocaleTimeString)(this, locales, options);
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
return 'Invalid Date';
|
|
36
|
+
}
|
|
22
37
|
},
|
|
23
38
|
});
|
|
24
39
|
}
|