@bbn/bbn 2.0.73 → 2.0.75
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/dt/classes/dt.d.ts +1 -0
- package/dist/dt/classes/dt.js +14 -4
- package/dist/dt.js +3 -0
- package/package.json +1 -1
package/dist/dt/classes/dt.d.ts
CHANGED
|
@@ -83,6 +83,7 @@ export declare abstract class bbnDt<TValue extends bbnDtTemporal> {
|
|
|
83
83
|
get S(): string;
|
|
84
84
|
get WW(): string;
|
|
85
85
|
get W(): string;
|
|
86
|
+
get isValid(): boolean;
|
|
86
87
|
format(format?: string): string;
|
|
87
88
|
matchFormat(value: any, format: string): boolean;
|
|
88
89
|
getWeekday(n: 0 | 1 | 2 | 3 | 4 | 5 | 6, mode?: string, locale?: string): string;
|
package/dist/dt/classes/dt.js
CHANGED
|
@@ -486,6 +486,9 @@ export class bbnDt {
|
|
|
486
486
|
}
|
|
487
487
|
return undefined;
|
|
488
488
|
}
|
|
489
|
+
get isValid() {
|
|
490
|
+
return this.value !== undefined;
|
|
491
|
+
}
|
|
489
492
|
format(format = 'YYYY-MM-DD HH:II:SS') {
|
|
490
493
|
let str = '';
|
|
491
494
|
if (format) {
|
|
@@ -664,10 +667,17 @@ export class bbnDt {
|
|
|
664
667
|
throw new Error('Invalid unit for startOf: ' + unit);
|
|
665
668
|
}
|
|
666
669
|
let v = this.value;
|
|
667
|
-
const zeroTime = (obj) =>
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
670
|
+
const zeroTime = (obj) => {
|
|
671
|
+
const change = {};
|
|
672
|
+
if ('hour' in obj) {
|
|
673
|
+
Object.assign(change, {
|
|
674
|
+
hour: 0, minute: 0, second: 0,
|
|
675
|
+
millisecond: 0, microsecond: 0, nanosecond: 0,
|
|
676
|
+
});
|
|
677
|
+
return obj.with(change);
|
|
678
|
+
}
|
|
679
|
+
return obj;
|
|
680
|
+
};
|
|
671
681
|
switch (u) {
|
|
672
682
|
case 'y':
|
|
673
683
|
if (!('year' in v)) {
|
package/dist/dt.js
CHANGED
|
@@ -220,6 +220,9 @@ const dt = (value, inputFormat = null, cls = 'auto') => {
|
|
|
220
220
|
const d = value;
|
|
221
221
|
return new bbnDtDateTime(d.getFullYear(), d.getMonth() + 1, d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds());
|
|
222
222
|
}
|
|
223
|
+
else {
|
|
224
|
+
return { isValid: false };
|
|
225
|
+
}
|
|
223
226
|
//throw new Error(_('Invalid date value: %s', value));
|
|
224
227
|
};
|
|
225
228
|
dt.locales = Object.create(null);
|