@bbn/bbn 2.0.128 → 2.0.129
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/dist/bbn.js +1 -1
- package/dist/bbn.js.map +1 -1
- package/dist/com.js +14 -3
- package/dist/dt/functions/parse.js +4 -0
- package/package.json +1 -1
package/dist/com.js
CHANGED
|
@@ -70,10 +70,21 @@ const fetchRequest = (method, url, config = {}, aborter) => {
|
|
|
70
70
|
const fetchPromise = fetch(url, fetchConfig).then((res) => __awaiter(void 0, void 0, void 0, function* () {
|
|
71
71
|
let data;
|
|
72
72
|
const contentType = res.headers.get('content-type') || '';
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
try {
|
|
74
|
+
if (contentType.includes('application/json')) {
|
|
75
|
+
data = yield res.json();
|
|
76
|
+
}
|
|
77
|
+
else if (contentType.startsWith('text/')) {
|
|
78
|
+
data = yield res.text();
|
|
79
|
+
}
|
|
80
|
+
else if (contentType.includes("multipart/")) {
|
|
81
|
+
data = yield res.arrayBuffer();
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
data = yield res.blob();
|
|
85
|
+
}
|
|
75
86
|
}
|
|
76
|
-
|
|
87
|
+
catch (_a) {
|
|
77
88
|
data = yield res.text();
|
|
78
89
|
}
|
|
79
90
|
const response = {
|
|
@@ -633,6 +633,10 @@ export default function parse(input, format, cls = 'auto', force, locale) {
|
|
|
633
633
|
const d = new T.PlainTime(ctx.hour, ctx.minute, ctx.second, ctx.ms * 1000000);
|
|
634
634
|
dtObj = new bbnDtTime(d);
|
|
635
635
|
}
|
|
636
|
+
else if (isClsAuto && !hasDate && !hasTime && ctx.hasYear) {
|
|
637
|
+
const d = new T.PlainDate(ctx.year, 1, 1);
|
|
638
|
+
dtObj = new bbnDtDate(d);
|
|
639
|
+
}
|
|
636
640
|
else {
|
|
637
641
|
throw new Error('No date or time information found in input');
|
|
638
642
|
}
|