@bbn/bbn 2.0.120 → 2.0.122

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/com.js CHANGED
@@ -108,7 +108,7 @@ const xhrRequest = (method, url, config = {}, aborter) => {
108
108
  const xhr = new XMLHttpRequest();
109
109
  const hasBody = methodsWithBody.includes(method.toUpperCase());
110
110
  const promise = new Promise((resolve, reject) => {
111
- xhr.open(method, url, true);
111
+ xhr.open(method.toUpperCase(), url, true);
112
112
  // Set headers
113
113
  const { body, headers } = normalizeDataAndHeaders(config.data, config.headers);
114
114
  headers.forEach((value, key) => {
@@ -329,6 +329,18 @@ export default function parse(input, format, cls = 'auto', force, locale) {
329
329
  ctx.hasSecond = true;
330
330
  }
331
331
  },
332
+ {
333
+ token: 'ss', // PHP-like seconds
334
+ regex: '\\d{2}',
335
+ apply: (v, ctx) => {
336
+ const n = parseInt(v, 10);
337
+ if (n < 0 || n > 59) {
338
+ throw new Error('Invalid second: ' + n);
339
+ }
340
+ ctx.second = n;
341
+ ctx.hasSecond = true;
342
+ }
343
+ },
332
344
  {
333
345
  token: 's', // PHP-like seconds
334
346
  regex: '\\d{2}',
@@ -483,9 +495,6 @@ export default function parse(input, format, cls = 'auto', force, locale) {
483
495
  let pattern = '';
484
496
  const applyFns = [];
485
497
  let i = 0;
486
- if (fmt === "YYYY-MM-DD HH:mm:ss") {
487
- debugger;
488
- }
489
498
  while (i < fmt.length) {
490
499
  // 1) Handle [literal] blocks first
491
500
  if (fmt[i] === '[') {
@@ -529,6 +538,10 @@ export default function parse(input, format, cls = 'auto', force, locale) {
529
538
  pattern += escapeRegex(fmt[i]);
530
539
  i += 1;
531
540
  }
541
+ if (!ctx.month && (fmt === "YYYY-MM-DD HH:mm:ss")) {
542
+ bbn.fn.log(i);
543
+ debugger;
544
+ }
532
545
  }
533
546
  const fullRegex = new RegExp('^' + pattern + '$');
534
547
  let match = fullRegex.exec(input);
@@ -538,9 +551,6 @@ export default function parse(input, format, cls = 'auto', force, locale) {
538
551
  input = inputDate.format(fmt);
539
552
  isValid = false;
540
553
  match = fullRegex.exec(input);
541
- if (!match) {
542
- debugger;
543
- }
544
554
  }
545
555
  else {
546
556
  throw new Error(`Date string "${input}" does not match format "${fmt}"`);
package/dist/dt.js CHANGED
@@ -222,7 +222,6 @@ const dt = (value, inputFormat = null, cls = 'auto') => {
222
222
  }
223
223
  else {
224
224
  bbn.fn.log('Invalid date value', value);
225
- debugger;
226
225
  throw new Error(_('Invalid date value'));
227
226
  }
228
227
  //throw new Error(_('Invalid date value: %s', value));
@@ -20,10 +20,8 @@ import com from '../../com.js';
20
20
  export default function upload(url, file, success = null, failure = null, progress = null) {
21
21
  const fn = () => {
22
22
  return com.run('post', url || bbn.env.path, {
23
- data: objectToFormData({ file }),
24
- headers: {
25
- 'Content-Type': 'multipart/form-data',
26
- },
23
+ data: objectToFormData(file),
24
+ headers: {},
27
25
  onUploadProgress(progressEvent) {
28
26
  if (progress) {
29
27
  let percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "2.0.120",
3
+ "version": "2.0.122",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",