@konplit-services/common 1.0.158 → 1.0.160
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/helper/date-processing.d.ts +5 -0
- package/build/helper/date-processing.js +13 -1
- package/build/helper/index.d.ts +1 -0
- package/build/helper/index.js +1 -0
- package/build/helper/wallet-transaction.types.d.ts +5 -0
- package/build/helper/wallet-transaction.types.js +9 -0
- package/package.json +1 -1
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { PLAN_INTERVAL } from "./plan-types";
|
|
2
2
|
export declare const formatDate: (dataString: string) => string;
|
|
3
3
|
export declare const formatDateTime: (dataString: string) => string;
|
|
4
|
+
export declare const convertToDate: (date: string) => Date;
|
|
5
|
+
export declare const getPreviousDayRange: () => {
|
|
6
|
+
startOfPreviousDay: Date;
|
|
7
|
+
endOfPreviousDay: Date;
|
|
8
|
+
};
|
|
4
9
|
type PlanInterval = keyof typeof PLAN_INTERVAL;
|
|
5
10
|
export declare const getDuration: (duration: PlanInterval) => number;
|
|
6
11
|
export {};
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getDuration = exports.formatDateTime = exports.formatDate = void 0;
|
|
6
|
+
exports.getDuration = exports.getPreviousDayRange = exports.convertToDate = exports.formatDateTime = exports.formatDate = void 0;
|
|
7
7
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
8
8
|
const plan_types_1 = require("./plan-types");
|
|
9
9
|
const formatDate = (dataString) => {
|
|
@@ -14,6 +14,18 @@ const formatDateTime = (dataString) => {
|
|
|
14
14
|
return (0, dayjs_1.default)(dataString).format("YYYY-MM-DD HH:mm:ss");
|
|
15
15
|
};
|
|
16
16
|
exports.formatDateTime = formatDateTime;
|
|
17
|
+
const convertToDate = (date) => {
|
|
18
|
+
return (0, dayjs_1.default)(date).toDate();
|
|
19
|
+
};
|
|
20
|
+
exports.convertToDate = convertToDate;
|
|
21
|
+
const getPreviousDayRange = () => {
|
|
22
|
+
// Get the start of the previous day (00:00:00)
|
|
23
|
+
const startOfPreviousDay = (0, dayjs_1.default)().subtract(1, "day").startOf("day").toDate();
|
|
24
|
+
// Get the end of the previous day (23:59:59.999)
|
|
25
|
+
const endOfPreviousDay = (0, dayjs_1.default)(startOfPreviousDay).endOf("day").toDate();
|
|
26
|
+
return { startOfPreviousDay, endOfPreviousDay };
|
|
27
|
+
};
|
|
28
|
+
exports.getPreviousDayRange = getPreviousDayRange;
|
|
17
29
|
const getDuration = (duration) => {
|
|
18
30
|
const currentDate = (0, dayjs_1.default)();
|
|
19
31
|
switch (duration) {
|
package/build/helper/index.d.ts
CHANGED
package/build/helper/index.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WalletTransactionType = void 0;
|
|
4
|
+
var WalletTransactionType;
|
|
5
|
+
(function (WalletTransactionType) {
|
|
6
|
+
WalletTransactionType["SETTLEMENT"] = "SETTLEMENT";
|
|
7
|
+
WalletTransactionType["WALLET_TOP"] = "WALLET_TOP";
|
|
8
|
+
WalletTransactionType["CHARGES"] = "CHARGES";
|
|
9
|
+
})(WalletTransactionType = exports.WalletTransactionType || (exports.WalletTransactionType = {}));
|