@vibe-flats/booking-engine-common-server 1.0.46 → 1.0.47
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/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
|
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./src/units-models"), exports);
|
|
18
18
|
__exportStar(require("./src/config/app"), exports);
|
|
19
19
|
__exportStar(require("./src/utils/guesty-price"), exports);
|
|
20
|
+
__exportStar(require("./src/utils/monthly-diff"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const calculatePreciseMonthDifference: (from: Date, to: Date) => number;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.calculatePreciseMonthDifference = void 0;
|
|
7
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
8
|
+
const calculatePreciseMonthDifference = (from, to) => {
|
|
9
|
+
//
|
|
10
|
+
const monthsDiff = (0, dayjs_1.default)(to).diff(from, 'month', true);
|
|
11
|
+
if (monthsDiff >= 1) {
|
|
12
|
+
return monthsDiff;
|
|
13
|
+
}
|
|
14
|
+
const daysDiff = (0, dayjs_1.default)(to).diff(from, 'day');
|
|
15
|
+
return Number((daysDiff / 30).toFixed(2));
|
|
16
|
+
};
|
|
17
|
+
exports.calculatePreciseMonthDifference = calculatePreciseMonthDifference;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vibe-flats/booking-engine-common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.47",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"typescript": "^5.1.6"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
+
"dayjs": "^1.11.13",
|
|
24
25
|
"mongoose": "^8.5.2"
|
|
25
26
|
}
|
|
26
27
|
}
|