@8ms/helpers 2.0.14 → 2.0.15
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/.yarn/install-state.gz +0 -0
- package/date/calculation.d.ts +5 -1
- package/date/calculation.js +10 -1
- package/date/index.d.ts +3 -3
- package/date/index.js +18 -39
- package/package.json +1 -1
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/date/calculation.d.ts
CHANGED
|
@@ -17,7 +17,11 @@ export declare const getDate: (input?: InputDate, setMidnight?: boolean) => Date
|
|
|
17
17
|
* This function checks whether the day of the week for the provided input corresponds
|
|
18
18
|
* to Saturday or Sunday, where weekday values of 6 and 7 represent Saturday and Sunday, respectively.
|
|
19
19
|
*/
|
|
20
|
-
export declare const isWeekend: (input
|
|
20
|
+
export declare const isWeekend: (input?: InputDate) => boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Calculates the difference in minutes between two provided dates.
|
|
23
|
+
*/
|
|
24
|
+
export declare const differenceInMinutes: (start: InputDate, end: InputDate) => number;
|
|
21
25
|
/**
|
|
22
26
|
* Calculates the difference in business days between two dates.
|
|
23
27
|
* Business days are considered as weekdays (Monday to Friday).
|
package/date/calculation.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isLastWeek = exports.isThisWeek = exports.getYesterday = exports.getWeeksAgo = exports.getToday = exports.getTwoWeeksAgo = exports.getThisWeek = exports.getLastWeek = exports.getSunday = exports.getMonday = exports.getMin = exports.getMax = exports.getDatesBetween = exports.differenceInBusinessDays = exports.isWeekend = exports.getDate = exports.getUnix = exports.getUtcDate = void 0;
|
|
3
|
+
exports.isLastWeek = exports.isThisWeek = exports.getYesterday = exports.getWeeksAgo = exports.getToday = exports.getTwoWeeksAgo = exports.getThisWeek = exports.getLastWeek = exports.getSunday = exports.getMonday = exports.getMin = exports.getMax = exports.getDatesBetween = exports.differenceInBusinessDays = exports.differenceInMinutes = exports.isWeekend = exports.getDate = exports.getUnix = exports.getUtcDate = void 0;
|
|
4
4
|
const luxon_1 = require("luxon");
|
|
5
5
|
/**
|
|
6
6
|
* Convert an client's input (any time-zone) ready to be used by the server (UTC).
|
|
@@ -74,6 +74,15 @@ const isWeekend = (input) => {
|
|
|
74
74
|
return date.weekday >= 6;
|
|
75
75
|
};
|
|
76
76
|
exports.isWeekend = isWeekend;
|
|
77
|
+
/**
|
|
78
|
+
* Calculates the difference in minutes between two provided dates.
|
|
79
|
+
*/
|
|
80
|
+
const differenceInMinutes = (start, end) => {
|
|
81
|
+
const startDate = (0, exports.getDate)(start);
|
|
82
|
+
const endDate = (0, exports.getDate)(end);
|
|
83
|
+
return endDate.diff(startDate, 'minutes').minutes;
|
|
84
|
+
};
|
|
85
|
+
exports.differenceInMinutes = differenceInMinutes;
|
|
77
86
|
/**
|
|
78
87
|
* Calculates the difference in business days between two dates.
|
|
79
88
|
* Business days are considered as weekdays (Monday to Friday).
|
package/date/index.d.ts
CHANGED
|
@@ -30,6 +30,6 @@ export declare enum Month {
|
|
|
30
30
|
NOVEMBER = "NOVEMBER",
|
|
31
31
|
DECEMBER = "DECEMBER"
|
|
32
32
|
}
|
|
33
|
-
export
|
|
34
|
-
export
|
|
35
|
-
export
|
|
33
|
+
export * from "./calculation";
|
|
34
|
+
export * from "./financialYear";
|
|
35
|
+
export * from "./format";
|
package/date/index.js
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
17
|
+
exports.Month = void 0;
|
|
4
18
|
/**
|
|
5
19
|
* Used by Google Ads API.
|
|
6
20
|
*/
|
|
@@ -19,41 +33,6 @@ var Month;
|
|
|
19
33
|
Month["NOVEMBER"] = "NOVEMBER";
|
|
20
34
|
Month["DECEMBER"] = "DECEMBER";
|
|
21
35
|
})(Month || (exports.Month = Month = {}));
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Object.defineProperty(exports, "getDatesBetween", { enumerable: true, get: function () { return calculation_1.getDatesBetween; } });
|
|
26
|
-
Object.defineProperty(exports, "getMax", { enumerable: true, get: function () { return calculation_1.getMax; } });
|
|
27
|
-
Object.defineProperty(exports, "getMin", { enumerable: true, get: function () { return calculation_1.getMin; } });
|
|
28
|
-
Object.defineProperty(exports, "getMonday", { enumerable: true, get: function () { return calculation_1.getMonday; } });
|
|
29
|
-
Object.defineProperty(exports, "getSunday", { enumerable: true, get: function () { return calculation_1.getSunday; } });
|
|
30
|
-
Object.defineProperty(exports, "getThisWeek", { enumerable: true, get: function () { return calculation_1.getThisWeek; } });
|
|
31
|
-
Object.defineProperty(exports, "getLastWeek", { enumerable: true, get: function () { return calculation_1.getLastWeek; } });
|
|
32
|
-
Object.defineProperty(exports, "getTwoWeeksAgo", { enumerable: true, get: function () { return calculation_1.getTwoWeeksAgo; } });
|
|
33
|
-
Object.defineProperty(exports, "getToday", { enumerable: true, get: function () { return calculation_1.getToday; } });
|
|
34
|
-
Object.defineProperty(exports, "getWeeksAgo", { enumerable: true, get: function () { return calculation_1.getWeeksAgo; } });
|
|
35
|
-
Object.defineProperty(exports, "getYesterday", { enumerable: true, get: function () { return calculation_1.getYesterday; } });
|
|
36
|
-
Object.defineProperty(exports, "isThisWeek", { enumerable: true, get: function () { return calculation_1.isThisWeek; } });
|
|
37
|
-
Object.defineProperty(exports, "isLastWeek", { enumerable: true, get: function () { return calculation_1.isLastWeek; } });
|
|
38
|
-
Object.defineProperty(exports, "isWeekend", { enumerable: true, get: function () { return calculation_1.isWeekend; } });
|
|
39
|
-
Object.defineProperty(exports, "differenceInBusinessDays", { enumerable: true, get: function () { return calculation_1.differenceInBusinessDays; } });
|
|
40
|
-
var financialYear_1 = require("./financialYear");
|
|
41
|
-
Object.defineProperty(exports, "getFinancialYear", { enumerable: true, get: function () { return financialYear_1.getFinancialYear; } });
|
|
42
|
-
Object.defineProperty(exports, "getFinancialYearToDate", { enumerable: true, get: function () { return financialYear_1.getFinancialYearToDate; } });
|
|
43
|
-
Object.defineProperty(exports, "getFinancialYearToYesterday", { enumerable: true, get: function () { return financialYear_1.getFinancialYearToYesterday; } });
|
|
44
|
-
Object.defineProperty(exports, "getFinancialYearWeeks", { enumerable: true, get: function () { return financialYear_1.getFinancialYearWeeks; } });
|
|
45
|
-
var format_1 = require("./format");
|
|
46
|
-
Object.defineProperty(exports, "format", { enumerable: true, get: function () { return format_1.format; } });
|
|
47
|
-
Object.defineProperty(exports, "getDayNumber", { enumerable: true, get: function () { return format_1.getDayNumber; } });
|
|
48
|
-
Object.defineProperty(exports, "getFullDate", { enumerable: true, get: function () { return format_1.getFullDate; } });
|
|
49
|
-
Object.defineProperty(exports, "getFullDateTime", { enumerable: true, get: function () { return format_1.getFullDateTime; } });
|
|
50
|
-
Object.defineProperty(exports, "getDurationHours", { enumerable: true, get: function () { return format_1.getDurationHours; } });
|
|
51
|
-
Object.defineProperty(exports, "getDurationMinutes", { enumerable: true, get: function () { return format_1.getDurationMinutes; } });
|
|
52
|
-
Object.defineProperty(exports, "getMonthYearString", { enumerable: true, get: function () { return format_1.getMonthYearString; } });
|
|
53
|
-
Object.defineProperty(exports, "getTodayYmdString", { enumerable: true, get: function () { return format_1.getTodayYmdString; } });
|
|
54
|
-
Object.defineProperty(exports, "getYearNumber", { enumerable: true, get: function () { return format_1.getYearNumber; } });
|
|
55
|
-
Object.defineProperty(exports, "getYmdHisNumber", { enumerable: true, get: function () { return format_1.getYmdHisNumber; } });
|
|
56
|
-
Object.defineProperty(exports, "getYmdHisString", { enumerable: true, get: function () { return format_1.getYmdHisString; } });
|
|
57
|
-
Object.defineProperty(exports, "getYmdNumber", { enumerable: true, get: function () { return format_1.getYmdNumber; } });
|
|
58
|
-
Object.defineProperty(exports, "getYmdString", { enumerable: true, get: function () { return format_1.getYmdString; } });
|
|
59
|
-
Object.defineProperty(exports, "parseExcelDate", { enumerable: true, get: function () { return format_1.parseExcelDate; } });
|
|
36
|
+
__exportStar(require("./calculation"), exports);
|
|
37
|
+
__exportStar(require("./financialYear"), exports);
|
|
38
|
+
__exportStar(require("./format"), exports);
|