@bbn/bbn 1.0.489 → 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/date.d.ts CHANGED
@@ -47,7 +47,8 @@ declare class bbnDateTool {
47
47
  fdate(long?: boolean, withTime?: boolean, weekday?: boolean): string;
48
48
  ftime(withSeconds?: boolean): string;
49
49
  format(format?: string): string;
50
- unix(ms?: boolean): number;
50
+ unix(ms?: boolean | number): number | bbnDateTool;
51
+ sql(noTime?: boolean): string;
51
52
  /**
52
53
  * Compare this date to another date with a given precision.
53
54
  * @returns -1 if this < other, 0 if equal, 1 if this > other
package/dist/date.js CHANGED
@@ -631,6 +631,11 @@ class bbnDateTool {
631
631
  return str;
632
632
  }
633
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
+ }
634
639
  if (__classPrivateFieldGet(this, _bbnDateTool_value, "f")) {
635
640
  if (ms) {
636
641
  return __classPrivateFieldGet(this, _bbnDateTool_value, "f").getTime();
@@ -641,6 +646,14 @@ class bbnDateTool {
641
646
  }
642
647
  return 0;
643
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
+ }
644
657
  /**
645
658
  * Compare this date to another date with a given precision.
646
659
  * @returns -1 if this < other, 0 if equal, 1 if this > other
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "1.0.489",
3
+ "version": "1.0.490",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",