@bbn/bbn 2.0.17 → 2.0.19

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/date.d.ts CHANGED
@@ -69,9 +69,9 @@ declare class bbnDateTool {
69
69
  add(value: number, unit?: string): bbnDateTool | null;
70
70
  subtract(value: number, unit?: string): bbnDateTool;
71
71
  dateFromFormat(value: string, unit: string | null): Date;
72
- date(): string;
73
- datetime(): string;
74
- time(): string;
72
+ date(v: any): string | bbnDateTool;
73
+ datetime(v: any): string | bbnDateTool;
74
+ time(v: any): string | bbnDateTool;
75
75
  fdate(long?: boolean, withTime?: boolean, weekday?: boolean): string;
76
76
  ftime(withSeconds?: boolean): string;
77
77
  format(format?: string): string;
package/dist/date.js CHANGED
@@ -822,14 +822,16 @@ class bbnDateTool {
822
822
  __classPrivateFieldSet(this, _bbnDateTool_value, new Date(...value), "f");
823
823
  }
824
824
  }
825
- if (__classPrivateFieldGet(this, _bbnDateTool_value, "f") === undefined) {
826
- const obj = {};
827
- return new Proxy(this, {
828
- get: (target, prop) => {
829
- return undefined;
830
- }
831
- });
832
- }
825
+ /*
826
+ if (this.#value === undefined) {
827
+ const obj = {};
828
+ return new Proxy(this, {
829
+ get: (target, prop) => {
830
+ if (prop === 'isValid')
831
+ return undefined;
832
+ }
833
+ });
834
+ }*/
833
835
  }
834
836
  parse(input, format) {
835
837
  const d = bbnDateTool.parse(input, format);
@@ -1065,13 +1067,22 @@ class bbnDateTool {
1065
1067
  const d = new Date();
1066
1068
  return d;
1067
1069
  }
1068
- date() {
1070
+ date(v) {
1071
+ if (v) {
1072
+ return this.parse(v, 'Y-m-d');
1073
+ }
1069
1074
  return this.format('Y-m-d');
1070
1075
  }
1071
- datetime() {
1076
+ datetime(v) {
1077
+ if (v) {
1078
+ return this.parse(v, 'Y-m-d H:i:s');
1079
+ }
1072
1080
  return this.format('Y-m-d H:i:s');
1073
1081
  }
1074
- time() {
1082
+ time(v) {
1083
+ if (v) {
1084
+ return this.parse(v, 'H:i:s');
1085
+ }
1075
1086
  return this.format('H:i:s');
1076
1087
  }
1077
1088
  fdate(long = false, withTime = false, weekday = false) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "2.0.17",
3
+ "version": "2.0.19",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",