@bbn/bbn 2.0.18 → 2.0.20
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/date.d.ts +10 -10
- package/dist/date.js +19 -10
- package/package.json +1 -1
package/dist/date.d.ts
CHANGED
|
@@ -26,13 +26,13 @@ declare class bbnDateTool {
|
|
|
26
26
|
parse(input: string, format: string): bbnDateTool;
|
|
27
27
|
matchFormat(value: any, format: string): boolean;
|
|
28
28
|
toString(): string;
|
|
29
|
-
year(v?:
|
|
30
|
-
month(v?:
|
|
31
|
-
day(v?:
|
|
32
|
-
hour(v?:
|
|
33
|
-
minute(v?:
|
|
34
|
-
second(v?:
|
|
35
|
-
weekday(v?:
|
|
29
|
+
year(v?: any): number | bbnDateTool;
|
|
30
|
+
month(v?: any): number | bbnDateTool;
|
|
31
|
+
day(v?: any): number | bbnDateTool;
|
|
32
|
+
hour(v?: any): number | bbnDateTool;
|
|
33
|
+
minute(v?: any): number | bbnDateTool;
|
|
34
|
+
second(v?: any): number | bbnDateTool;
|
|
35
|
+
weekday(v?: any, past?: boolean): number | bbnDateTool;
|
|
36
36
|
/**
|
|
37
37
|
* Returns the ISO-8601 week number of this date.
|
|
38
38
|
* Week starts on Monday, and week 1 is the week with Jan 4.
|
|
@@ -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
|
@@ -850,7 +850,7 @@ class bbnDateTool {
|
|
|
850
850
|
return __classPrivateFieldGet(this, _bbnDateTool_value, "f") ? this.format() : '';
|
|
851
851
|
}
|
|
852
852
|
year(v) {
|
|
853
|
-
if (0 in arguments) {
|
|
853
|
+
if (0 in arguments && (v !== undefined) && !(v instanceof Event)) {
|
|
854
854
|
const d = this.copy();
|
|
855
855
|
d.setFullYear(v);
|
|
856
856
|
return new bbnDateTool(d);
|
|
@@ -858,7 +858,7 @@ class bbnDateTool {
|
|
|
858
858
|
return __classPrivateFieldGet(this, _bbnDateTool_value, "f").getFullYear();
|
|
859
859
|
}
|
|
860
860
|
month(v) {
|
|
861
|
-
if (0 in arguments) {
|
|
861
|
+
if (0 in arguments && (v !== undefined) && !(v instanceof Event)) {
|
|
862
862
|
const d = this.copy();
|
|
863
863
|
d.setMonth(v - 1);
|
|
864
864
|
return new bbnDateTool(d);
|
|
@@ -866,7 +866,7 @@ class bbnDateTool {
|
|
|
866
866
|
return __classPrivateFieldGet(this, _bbnDateTool_value, "f").getMonth() + 1;
|
|
867
867
|
}
|
|
868
868
|
day(v) {
|
|
869
|
-
if (0 in arguments) {
|
|
869
|
+
if (0 in arguments && (v !== undefined) && !(v instanceof Event)) {
|
|
870
870
|
const d = this.copy();
|
|
871
871
|
d.setDate(v);
|
|
872
872
|
return new bbnDateTool(d);
|
|
@@ -874,7 +874,7 @@ class bbnDateTool {
|
|
|
874
874
|
return __classPrivateFieldGet(this, _bbnDateTool_value, "f").getDate();
|
|
875
875
|
}
|
|
876
876
|
hour(v) {
|
|
877
|
-
if (0 in arguments) {
|
|
877
|
+
if (0 in arguments && (v !== undefined) && !(v instanceof Event)) {
|
|
878
878
|
const d = this.copy();
|
|
879
879
|
d.setHours(v);
|
|
880
880
|
return new bbnDateTool(d);
|
|
@@ -882,7 +882,7 @@ class bbnDateTool {
|
|
|
882
882
|
return __classPrivateFieldGet(this, _bbnDateTool_value, "f").getHours();
|
|
883
883
|
}
|
|
884
884
|
minute(v) {
|
|
885
|
-
if (0 in arguments) {
|
|
885
|
+
if (0 in arguments && (v !== undefined) && !(v instanceof Event)) {
|
|
886
886
|
const d = this.copy();
|
|
887
887
|
d.setMinutes(v);
|
|
888
888
|
return new bbnDateTool(d);
|
|
@@ -890,7 +890,7 @@ class bbnDateTool {
|
|
|
890
890
|
return __classPrivateFieldGet(this, _bbnDateTool_value, "f").getMinutes();
|
|
891
891
|
}
|
|
892
892
|
second(v) {
|
|
893
|
-
if (0 in arguments) {
|
|
893
|
+
if (0 in arguments && (v !== undefined) && !(v instanceof Event)) {
|
|
894
894
|
const d = this.copy();
|
|
895
895
|
d.setSeconds(v);
|
|
896
896
|
return new bbnDateTool(d);
|
|
@@ -898,7 +898,7 @@ class bbnDateTool {
|
|
|
898
898
|
return __classPrivateFieldGet(this, _bbnDateTool_value, "f").getSeconds();
|
|
899
899
|
}
|
|
900
900
|
weekday(v, past = false) {
|
|
901
|
-
if (0 in arguments) {
|
|
901
|
+
if (0 in arguments && (v !== undefined) && !(v instanceof Event)) {
|
|
902
902
|
return this.setWeekday(v, past);
|
|
903
903
|
}
|
|
904
904
|
return __classPrivateFieldGet(this, _bbnDateTool_value, "f").getDay();
|
|
@@ -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 (0 in arguments && (v !== undefined) && !(v instanceof Event)) {
|
|
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 (0 in arguments && (v !== undefined) && !(v instanceof Event)) {
|
|
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 (0 in arguments && (v !== undefined) && !(v instanceof Event)) {
|
|
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) {
|