@8ms/helpers 1.0.12 → 1.0.13
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/getMax.d.ts +3 -2
- package/dist/date/getMax.js +5 -7
- package/dist/date/getMin.d.ts +9 -0
- package/dist/date/getMin.js +17 -0
- package/dist/date/index.d.ts +2 -1
- package/dist/date/index.js +3 -1
- package/package.json +1 -1
package/dist/date/getMax.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { DateType } from './types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* If a given date is beyond the maximum, return the maximum.
|
|
4
4
|
*/
|
|
5
|
-
declare const getMax: ({ input }: {
|
|
5
|
+
declare const getMax: ({ input, max }: {
|
|
6
6
|
input: DateType;
|
|
7
|
+
max: DateType;
|
|
7
8
|
}) => Date;
|
|
8
9
|
export default getMax;
|
package/dist/date/getMax.js
CHANGED
|
@@ -5,15 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
var isAfter_1 = __importDefault(require("date-fns/isAfter"));
|
|
7
7
|
var getDate_1 = __importDefault(require("./getDate"));
|
|
8
|
-
var getYesterday_1 = __importDefault(require("./getYesterday"));
|
|
9
8
|
/**
|
|
10
|
-
*
|
|
9
|
+
* If a given date is beyond the maximum, return the maximum.
|
|
11
10
|
*/
|
|
12
11
|
var getMax = function (_a) {
|
|
13
|
-
var input = _a.input;
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
return max;
|
|
12
|
+
var input = _a.input, max = _a.max;
|
|
13
|
+
var parsedMax = (0, getDate_1.default)({ input: max });
|
|
14
|
+
var parsedInput = (0, getDate_1.default)({ input: input });
|
|
15
|
+
return (0, isAfter_1.default)(parsedInput, parsedMax) ? parsedMax : parsedInput;
|
|
18
16
|
};
|
|
19
17
|
exports.default = getMax;
|
|
@@ -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
|
+
var isBefore_1 = __importDefault(require("date-fns/isBefore"));
|
|
7
|
+
var getDate_1 = __importDefault(require("./getDate"));
|
|
8
|
+
/**
|
|
9
|
+
* If a given date is before the minimum, return the minimum.
|
|
10
|
+
*/
|
|
11
|
+
var getMin = function (_a) {
|
|
12
|
+
var input = _a.input, min = _a.min;
|
|
13
|
+
var parsedMin = (0, getDate_1.default)({ input: min });
|
|
14
|
+
var parsedInput = (0, getDate_1.default)({ input: input });
|
|
15
|
+
return (0, isBefore_1.default)(parsedInput, parsedMin) ? parsedMin : parsedInput;
|
|
16
|
+
};
|
|
17
|
+
exports.default = getMin;
|
package/dist/date/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import getFinancialYear from './getFinancialYear';
|
|
|
7
7
|
import getFinancialYearToDate from './getFinancialYearToDate';
|
|
8
8
|
import getLastWeek from './getLastWeek';
|
|
9
9
|
import getMax from './getMax';
|
|
10
|
+
import getMin from './getMin';
|
|
10
11
|
import getMonday from './getMonday';
|
|
11
12
|
import getNumber from './getNumber';
|
|
12
13
|
import getPredefinedTimeframe from './getPredefinedTimeframe';
|
|
@@ -21,4 +22,4 @@ import isThisWeek from './isThisWeek';
|
|
|
21
22
|
import parseExcelDate from './parseExcelDate';
|
|
22
23
|
import { DateType, FinancialYearType, FinancialYearWeekType, TimeframePredefinedType, TimeframeType } from './types';
|
|
23
24
|
export type { DateType, FinancialYearType, FinancialYearWeekType, TimeframeType, TimeframePredefinedType, };
|
|
24
|
-
export { Duration, DurationComparison, Timeframe, TimeframePredefined, format, getDate, getDurationHours, getDurationMinutes, getFinancialYear, getFinancialYearToDate, getLastWeek, getMax, getMonday, getNumber, getPredefinedTimeframe, getSunday, getThisWeek, getToday, getTwoWeeksAgo, getYesterday, isDateValid, isLastWeek, isThisWeek, parseExcelDate, };
|
|
25
|
+
export { Duration, DurationComparison, Timeframe, TimeframePredefined, format, getDate, getDurationHours, getDurationMinutes, getFinancialYear, getFinancialYearToDate, getLastWeek, getMax, getMin, getMonday, getNumber, getPredefinedTimeframe, getSunday, getThisWeek, getToday, getTwoWeeksAgo, getYesterday, isDateValid, isLastWeek, isThisWeek, parseExcelDate, };
|
package/dist/date/index.js
CHANGED
|
@@ -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.parseExcelDate = exports.isThisWeek = exports.isLastWeek = exports.isDateValid = exports.getYesterday = exports.getTwoWeeksAgo = exports.getToday = exports.getThisWeek = exports.getSunday = exports.getPredefinedTimeframe = exports.getNumber = exports.getMonday = exports.getMax = exports.getLastWeek = exports.getFinancialYearToDate = exports.getFinancialYear = exports.getDurationMinutes = exports.getDurationHours = exports.getDate = exports.format = exports.TimeframePredefined = exports.Timeframe = exports.DurationComparison = exports.Duration = void 0;
|
|
6
|
+
exports.parseExcelDate = exports.isThisWeek = exports.isLastWeek = exports.isDateValid = exports.getYesterday = exports.getTwoWeeksAgo = exports.getToday = exports.getThisWeek = exports.getSunday = exports.getPredefinedTimeframe = exports.getNumber = exports.getMonday = exports.getMin = exports.getMax = exports.getLastWeek = exports.getFinancialYearToDate = exports.getFinancialYear = exports.getDurationMinutes = exports.getDurationHours = exports.getDate = exports.format = exports.TimeframePredefined = exports.Timeframe = exports.DurationComparison = exports.Duration = void 0;
|
|
7
7
|
var constants_1 = require("./constants");
|
|
8
8
|
Object.defineProperty(exports, "Duration", { enumerable: true, get: function () { return constants_1.Duration; } });
|
|
9
9
|
Object.defineProperty(exports, "DurationComparison", { enumerable: true, get: function () { return constants_1.DurationComparison; } });
|
|
@@ -25,6 +25,8 @@ var getLastWeek_1 = __importDefault(require("./getLastWeek"));
|
|
|
25
25
|
exports.getLastWeek = getLastWeek_1.default;
|
|
26
26
|
var getMax_1 = __importDefault(require("./getMax"));
|
|
27
27
|
exports.getMax = getMax_1.default;
|
|
28
|
+
var getMin_1 = __importDefault(require("./getMin"));
|
|
29
|
+
exports.getMin = getMin_1.default;
|
|
28
30
|
var getMonday_1 = __importDefault(require("./getMonday"));
|
|
29
31
|
exports.getMonday = getMonday_1.default;
|
|
30
32
|
var getNumber_1 = __importDefault(require("./getNumber"));
|