@bbn/bbn 1.0.489 → 1.0.491

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
@@ -27,6 +27,8 @@ declare class bbnDateTool {
27
27
  get EE(): string;
28
28
  get DD(): string;
29
29
  get d(): string;
30
+ get dddd(): string;
31
+ get ddd(): string;
30
32
  get D(): string;
31
33
  get HH(): string;
32
34
  get H(): string;
@@ -47,7 +49,8 @@ declare class bbnDateTool {
47
49
  fdate(long?: boolean, withTime?: boolean, weekday?: boolean): string;
48
50
  ftime(withSeconds?: boolean): string;
49
51
  format(format?: string): string;
50
- unix(ms?: boolean): number;
52
+ unix(ms?: boolean | number): number | bbnDateTool;
53
+ sql(noTime?: boolean): string;
51
54
  /**
52
55
  * Compare this date to another date with a given precision.
53
56
  * @returns -1 if this < other, 0 if equal, 1 if this > other
package/dist/date.js CHANGED
@@ -484,6 +484,20 @@ class bbnDateTool {
484
484
  get d() {
485
485
  return this.day().toString();
486
486
  }
487
+ get dddd() {
488
+ const opt = {
489
+ weekday: 'long'
490
+ };
491
+ const d = new Intl.DateTimeFormat([bbn.env.lang, ...navigator.languages], opt);
492
+ return d.format(__classPrivateFieldGet(this, _bbnDateTool_value, "f"));
493
+ }
494
+ get ddd() {
495
+ const opt = {
496
+ weekday: 'short'
497
+ };
498
+ const d = new Intl.DateTimeFormat([bbn.env.lang, ...navigator.languages], opt);
499
+ return d.format(__classPrivateFieldGet(this, _bbnDateTool_value, "f"));
500
+ }
487
501
  get D() {
488
502
  return this.day().toString();
489
503
  }
@@ -631,6 +645,11 @@ class bbnDateTool {
631
645
  return str;
632
646
  }
633
647
  unix(ms = false) {
648
+ if (typeof ms === 'number') {
649
+ const date = this.copy();
650
+ date.setTime(ms * 1000);
651
+ return new bbnDateTool(date);
652
+ }
634
653
  if (__classPrivateFieldGet(this, _bbnDateTool_value, "f")) {
635
654
  if (ms) {
636
655
  return __classPrivateFieldGet(this, _bbnDateTool_value, "f").getTime();
@@ -641,6 +660,14 @@ class bbnDateTool {
641
660
  }
642
661
  return 0;
643
662
  }
663
+ sql(noTime = false) {
664
+ if (!__classPrivateFieldGet(this, _bbnDateTool_value, "f")) {
665
+ return '';
666
+ }
667
+ return noTime
668
+ ? this.format('YYYY-MM-DD')
669
+ : this.format('YYYY-MM-DD HH:II:SS');
670
+ }
644
671
  /**
645
672
  * Compare this date to another date with a given precision.
646
673
  * @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.491",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",