@bbn/bbn 2.0.18 → 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
@@ -1067,13 +1067,22 @@ class bbnDateTool {
1067
1067
  const d = new Date();
1068
1068
  return d;
1069
1069
  }
1070
- date() {
1070
+ date(v) {
1071
+ if (v) {
1072
+ return this.parse(v, 'Y-m-d');
1073
+ }
1071
1074
  return this.format('Y-m-d');
1072
1075
  }
1073
- datetime() {
1076
+ datetime(v) {
1077
+ if (v) {
1078
+ return this.parse(v, 'Y-m-d H:i:s');
1079
+ }
1074
1080
  return this.format('Y-m-d H:i:s');
1075
1081
  }
1076
- time() {
1082
+ time(v) {
1083
+ if (v) {
1084
+ return this.parse(v, 'H:i:s');
1085
+ }
1077
1086
  return this.format('H:i:s');
1078
1087
  }
1079
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.18",
3
+ "version": "2.0.19",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",