@bbn/bbn 2.0.72 → 2.0.74

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.
@@ -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;
@@ -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) {
package/dist/dt.js CHANGED
@@ -220,7 +220,10 @@ 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
- throw new Error(_('Invalid date value: %s', value));
223
+ else {
224
+ return { isValid: false };
225
+ }
226
+ //throw new Error(_('Invalid date value: %s', value));
224
227
  };
225
228
  dt.locales = Object.create(null);
226
229
  dt.parse = parse;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "2.0.72",
3
+ "version": "2.0.74",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",