@bbn/bbn 2.0.226 → 2.0.228
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/bbn.sw.js +1 -1
- package/dist/bbn.sw.js.map +1 -1
- package/dist/dt/classes/dt.js +2 -2
- package/dist/dt/functions/parse.js +7 -5
- package/dist/dt.d.ts +1 -1
- package/dist/dt.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/dt/classes/dt.js
CHANGED
|
@@ -403,7 +403,7 @@ export class bbnDt {
|
|
|
403
403
|
if (!('year' in this.value)) {
|
|
404
404
|
throw new Error('year() is not supported for this type');
|
|
405
405
|
}
|
|
406
|
-
if ((v !== undefined) && !(v instanceof Event) && (
|
|
406
|
+
if ((v !== undefined) && !(v instanceof Event) && parseInt(v)) {
|
|
407
407
|
const d = this.value.with({ year: v });
|
|
408
408
|
return new this.constructor(d);
|
|
409
409
|
}
|
|
@@ -416,7 +416,7 @@ export class bbnDt {
|
|
|
416
416
|
if (!('month' in this.value)) {
|
|
417
417
|
throw new Error('month() is not supported for this type');
|
|
418
418
|
}
|
|
419
|
-
if ((v !== undefined) && !(v instanceof Event) && (
|
|
419
|
+
if ((v !== undefined) && !(v instanceof Event) && parseInt(v)) {
|
|
420
420
|
const d = this.value.with({ month: v });
|
|
421
421
|
return new this.constructor(d);
|
|
422
422
|
}
|
|
@@ -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
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
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
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