@bbn/bbn 2.0.136 → 2.0.137
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 +5 -1
- package/dist/dt/classes/dt.js +32 -1
- package/package.json +1 -1
package/dist/dt/classes/dt.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare abstract class bbnDt<TValue extends bbnDtTemporal> {
|
|
|
6
6
|
abstract readonly kind: bbnDtKind;
|
|
7
7
|
readonly __bbnNoData = true;
|
|
8
8
|
readonly __isBbnDt = true;
|
|
9
|
+
isValid: boolean;
|
|
9
10
|
constructor(value?: TValue);
|
|
10
11
|
setValid(isValid: boolean): void;
|
|
11
12
|
get value(): TValue | undefined;
|
|
@@ -65,7 +66,7 @@ export declare abstract class bbnDt<TValue extends bbnDtTemporal> {
|
|
|
65
66
|
date(v?: any): string | bbnDt<any>;
|
|
66
67
|
datetime(v?: any): string | bbnDt<any>;
|
|
67
68
|
time(v?: any): string | bbnDt<any>;
|
|
68
|
-
fdate(long?: boolean): string;
|
|
69
|
+
fdate(long?: boolean, withTime?: boolean): string;
|
|
69
70
|
ftime(withSeconds?: boolean): string;
|
|
70
71
|
week(): number;
|
|
71
72
|
get YYYY(): string;
|
|
@@ -112,5 +113,8 @@ export declare abstract class bbnDt<TValue extends bbnDtTemporal> {
|
|
|
112
113
|
startOf(unit?: string): bbnDt<any>;
|
|
113
114
|
endOf(unit?: string): bbnDt<any>;
|
|
114
115
|
clone(): bbnDt<any>;
|
|
116
|
+
inLeapYear(): boolean;
|
|
117
|
+
daysInMonth(): number;
|
|
118
|
+
valueOf(): number;
|
|
115
119
|
}
|
|
116
120
|
export default bbnDt;
|
package/dist/dt/classes/dt.js
CHANGED
|
@@ -464,7 +464,7 @@ export class bbnDt {
|
|
|
464
464
|
}
|
|
465
465
|
return this.HH + ':' + this.II + ':' + this.SS;
|
|
466
466
|
}
|
|
467
|
-
fdate(long = false) {
|
|
467
|
+
fdate(long = false, withTime = false) {
|
|
468
468
|
if (!this.value) {
|
|
469
469
|
return '';
|
|
470
470
|
}
|
|
@@ -1057,6 +1057,37 @@ export class bbnDt {
|
|
|
1057
1057
|
clone() {
|
|
1058
1058
|
return this.withValue(this.value);
|
|
1059
1059
|
}
|
|
1060
|
+
inLeapYear() {
|
|
1061
|
+
if (this.isValid) {
|
|
1062
|
+
const year = this.year();
|
|
1063
|
+
return (year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0);
|
|
1064
|
+
}
|
|
1065
|
+
return false;
|
|
1066
|
+
}
|
|
1067
|
+
daysInMonth() {
|
|
1068
|
+
if (this.isValid) {
|
|
1069
|
+
switch (this.month()) {
|
|
1070
|
+
case 1:
|
|
1071
|
+
if (this.year() % 4 === 0) {
|
|
1072
|
+
return 29;
|
|
1073
|
+
}
|
|
1074
|
+
else {
|
|
1075
|
+
return 28;
|
|
1076
|
+
}
|
|
1077
|
+
case 0:
|
|
1078
|
+
case 3:
|
|
1079
|
+
case 5:
|
|
1080
|
+
case 8:
|
|
1081
|
+
case 10:
|
|
1082
|
+
return 30;
|
|
1083
|
+
default:
|
|
1084
|
+
return 31;
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
valueOf() {
|
|
1089
|
+
return this.unix();
|
|
1090
|
+
}
|
|
1060
1091
|
}
|
|
1061
1092
|
_bbnDt_value = new WeakMap();
|
|
1062
1093
|
/** System time zone ID (e.g. "Europe/Rome") */
|