@bbn/bbn 1.0.488 → 1.0.490
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 +3 -1
- package/dist/date.js +16 -0
- package/package.json +1 -1
package/dist/date.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ declare class bbnDateTool {
|
|
|
26
26
|
get M(): string;
|
|
27
27
|
get EE(): string;
|
|
28
28
|
get DD(): string;
|
|
29
|
+
get d(): string;
|
|
29
30
|
get D(): string;
|
|
30
31
|
get HH(): string;
|
|
31
32
|
get H(): string;
|
|
@@ -46,7 +47,8 @@ declare class bbnDateTool {
|
|
|
46
47
|
fdate(long?: boolean, withTime?: boolean, weekday?: boolean): string;
|
|
47
48
|
ftime(withSeconds?: boolean): string;
|
|
48
49
|
format(format?: string): string;
|
|
49
|
-
unix(ms?: boolean): number;
|
|
50
|
+
unix(ms?: boolean | number): number | bbnDateTool;
|
|
51
|
+
sql(noTime?: boolean): string;
|
|
50
52
|
/**
|
|
51
53
|
* Compare this date to another date with a given precision.
|
|
52
54
|
* @returns -1 if this < other, 0 if equal, 1 if this > other
|
package/dist/date.js
CHANGED
|
@@ -481,6 +481,9 @@ class bbnDateTool {
|
|
|
481
481
|
const d = parseInt(this.day().toString());
|
|
482
482
|
return d < 10 ? '0' + d.toString() : d.toString();
|
|
483
483
|
}
|
|
484
|
+
get d() {
|
|
485
|
+
return this.day().toString();
|
|
486
|
+
}
|
|
484
487
|
get D() {
|
|
485
488
|
return this.day().toString();
|
|
486
489
|
}
|
|
@@ -628,6 +631,11 @@ class bbnDateTool {
|
|
|
628
631
|
return str;
|
|
629
632
|
}
|
|
630
633
|
unix(ms = false) {
|
|
634
|
+
if (typeof ms === 'number') {
|
|
635
|
+
const date = this.copy();
|
|
636
|
+
date.setTime(ms * 1000);
|
|
637
|
+
return new bbnDateTool(date);
|
|
638
|
+
}
|
|
631
639
|
if (__classPrivateFieldGet(this, _bbnDateTool_value, "f")) {
|
|
632
640
|
if (ms) {
|
|
633
641
|
return __classPrivateFieldGet(this, _bbnDateTool_value, "f").getTime();
|
|
@@ -638,6 +646,14 @@ class bbnDateTool {
|
|
|
638
646
|
}
|
|
639
647
|
return 0;
|
|
640
648
|
}
|
|
649
|
+
sql(noTime = false) {
|
|
650
|
+
if (!__classPrivateFieldGet(this, _bbnDateTool_value, "f")) {
|
|
651
|
+
return '';
|
|
652
|
+
}
|
|
653
|
+
return noTime
|
|
654
|
+
? this.format('YYYY-MM-DD')
|
|
655
|
+
: this.format('YYYY-MM-DD HH:II:SS');
|
|
656
|
+
}
|
|
641
657
|
/**
|
|
642
658
|
* Compare this date to another date with a given precision.
|
|
643
659
|
* @returns -1 if this < other, 0 if equal, 1 if this > other
|