@bbn/bbn 1.0.473 → 1.0.475

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.js CHANGED
@@ -500,6 +500,7 @@ class bbnDateTool {
500
500
  * @returns -1 if this < other, 0 if equal, 1 if this > other
501
501
  */
502
502
  compare(date, unit = '') {
503
+ var _a;
503
504
  const d = date instanceof bbnDateTool ? date : new bbnDateTool(date);
504
505
  const realUnit = unitsCorrespondence[unit] || null;
505
506
  // If no unit or unknown unit, fall back to timestamp comparison
@@ -515,7 +516,7 @@ class bbnDateTool {
515
516
  const order = ['y', 'm', 'd', 'h', 'i', 's'];
516
517
  // Compare step by step until the requested precision
517
518
  for (const u of order) {
518
- const key = units[u];
519
+ const key = (_a = bbn.fn.getRow(units, un => un[0] === u)) === null || _a === void 0 ? void 0 : _a[1];
519
520
  const a = this[key]();
520
521
  const b = d[key]();
521
522
  if (a < b) {
@@ -794,6 +795,9 @@ class bbnDateTool {
794
795
  }
795
796
  _bbnDateTool_value = new WeakMap(), _bbnDateTool_daysInMonth = new WeakMap();
796
797
  function generatorFunction(value, inputFormat = null) {
798
+ if (value instanceof bbnDateTool) {
799
+ return value;
800
+ }
797
801
  return new bbnDateTool(value, inputFormat);
798
802
  }
799
803
  export default generatorFunction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "1.0.473",
3
+ "version": "1.0.475",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",