@bbn/bbn 1.0.472 → 1.0.474
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.js +2 -1
- package/package.json +1 -1
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 =
|
|
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) {
|