@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.
@@ -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;
@@ -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") */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "2.0.136",
3
+ "version": "2.0.137",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",