@bbn/bbn 2.0.226 → 2.0.227

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.
@@ -565,11 +565,13 @@ export default function parse(input, format, cls = 'auto', force, locale) {
565
565
  throw new Error(`Date string "${input}" does not match format "${fmt}"`);
566
566
  }
567
567
  }
568
- for (let idx = 1; idx < match.length; idx++) {
569
- const value = match[idx];
570
- const apply = applyFns[idx - 1];
571
- if (value != null && apply) {
572
- apply(value);
568
+ if (match) {
569
+ for (let idx = 1; idx < match.length; idx++) {
570
+ const value = match[idx];
571
+ const apply = applyFns[idx - 1];
572
+ if (value != null && apply) {
573
+ apply(value);
574
+ }
573
575
  }
574
576
  }
575
577
  // ---- NEW: convert 12h + AM/PM to 24h ----
package/dist/dt.d.ts CHANGED
@@ -9,7 +9,7 @@ declare const dt: {
9
9
  time(): void;
10
10
  date(): void;
11
11
  dateTime(): void;
12
- duration(amount: any, unit: any): bbnDtDuration;
12
+ duration(amount: any, unit?: string): bbnDtDuration;
13
13
  zoned(): void;
14
14
  monthDay(): void;
15
15
  yearMonth(): void;
package/dist/dt.js CHANGED
@@ -241,7 +241,7 @@ dt.duration = (amount, unit) => {
241
241
  if (amount instanceof Temporal.Duration) {
242
242
  return new bbnDtDuration(amount);
243
243
  }
244
- return bbnDtDuration.fromUnit(amount, unit);
244
+ return bbnDtDuration.fromUnit(amount, unit || 'ms');
245
245
  };
246
246
  dt.zoned = () => { };
247
247
  dt.monthDay = () => { };
package/dist/index.js CHANGED
@@ -94,7 +94,7 @@ const bbn = {
94
94
  };
95
95
  if ('undefined' !== typeof globalThis) {
96
96
  globalThis.bbn = bbn;
97
- if (!globalThis.Temporal) {
97
+ if (!('Temporal' in globalThis)) {
98
98
  globalThis.Temporal = Temporal;
99
99
  }
100
100
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "2.0.226",
3
+ "version": "2.0.227",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",