@bbn/bbn 2.0.110 → 2.0.111

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.
@@ -87,6 +87,7 @@ export declare abstract class bbnDt<TValue extends bbnDtTemporal> {
87
87
  get S(): string;
88
88
  get WW(): string;
89
89
  get W(): string;
90
+ unix(ms?: boolean | number): number | bbnDt<any>;
90
91
  format(format?: string): string;
91
92
  matchFormat(value: any, format: string): boolean;
92
93
  getWeekday(n: 0 | 1 | 2 | 3 | 4 | 5 | 6, mode?: string, locale?: string): string | object;
@@ -624,6 +624,14 @@ export class bbnDt {
624
624
  }
625
625
  return undefined;
626
626
  }
627
+ unix(ms = false) {
628
+ if (typeof ms === 'number') {
629
+ const Ctor = this.constructor;
630
+ const d = new Date(ms);
631
+ return new Ctor(d);
632
+ }
633
+ return ms ? this.toEpochMs() : Math.floor(this.toEpochMs() / 1000);
634
+ }
627
635
  format(format = 'YYYY-MM-DD HH:II:SS') {
628
636
  let str = '';
629
637
  if (format) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "2.0.110",
3
+ "version": "2.0.111",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",