@zeniai/client-epic-state 4.9.81 → 4.9.82
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.
|
@@ -3,10 +3,10 @@ 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.isHoliday = exports.getYearsList = exports.filterDays = exports.isHolidayToday = exports.getPreviousNthWorkingDay = exports.getNextNthWorkingDay = exports.holidaysFormatted = exports.holidays = exports.PAYMENT_BUSINESS_DAYS = exports.endDate = exports.startDate = void 0;
|
|
6
|
+
exports.isHoliday = exports.getYearsList = exports.filterDays = exports.isHolidayToday = exports.getPreviousNthWorkingDay = exports.getNextNthWorkingDay = exports.holidaysFormatted = exports.holidays = exports.PAYMENT_BUSINESS_DAYS = exports.endDate = exports.startDate = exports.standardFormat = void 0;
|
|
7
7
|
const date_holidays_1 = __importDefault(require("date-holidays"));
|
|
8
8
|
const zeniDayJS_1 = require("../zeniDayJS");
|
|
9
|
-
|
|
9
|
+
exports.standardFormat = 'MM/DD/YYYY';
|
|
10
10
|
exports.startDate = '2000-01-01';
|
|
11
11
|
exports.endDate = '2070-12-31';
|
|
12
12
|
exports.PAYMENT_BUSINESS_DAYS = 4;
|
|
@@ -15,16 +15,16 @@ exports.holidays = dateHolidays
|
|
|
15
15
|
.getHolidays(new Date().getFullYear())
|
|
16
16
|
.filter((holiday) => holiday.type === 'public' || holiday.type === 'bank')
|
|
17
17
|
.map((holiday) => (0, zeniDayJS_1.date)(holiday.date).toDate()); // https://www.linkedin.com/pulse/fix-invalid-date-safari-ie-hatem-ahmad/
|
|
18
|
-
exports.holidaysFormatted = exports.holidays.map((holiday) => (0, zeniDayJS_1.date)(holiday.toDateString()).format(standardFormat));
|
|
18
|
+
exports.holidaysFormatted = exports.holidays.map((holiday) => (0, zeniDayJS_1.date)(holiday.toDateString()).format(exports.standardFormat));
|
|
19
19
|
const getNextNthWorkingDay = (date, filterDaysIndex, numberOfWorkingDays) => {
|
|
20
20
|
const currentDate = new Date(date.toDateString());
|
|
21
|
-
const holidaysFormatted = exports.holidays.map((holiday) => (0, zeniDayJS_1.date)(holiday.toDateString()).format(standardFormat));
|
|
21
|
+
const holidaysFormatted = exports.holidays.map((holiday) => (0, zeniDayJS_1.date)(holiday.toDateString()).format(exports.standardFormat));
|
|
22
22
|
Array(numberOfWorkingDays)
|
|
23
23
|
.fill(0)
|
|
24
24
|
.forEach(() => {
|
|
25
25
|
currentDate.setDate(currentDate.getDate() + 1);
|
|
26
26
|
while (filterDaysIndex.includes(currentDate.getDay()) ||
|
|
27
|
-
holidaysFormatted.indexOf((0, zeniDayJS_1.date)(currentDate.toDateString()).format(standardFormat)) != -1) {
|
|
27
|
+
holidaysFormatted.indexOf((0, zeniDayJS_1.date)(currentDate.toDateString()).format(exports.standardFormat)) != -1) {
|
|
28
28
|
currentDate.setDate(currentDate.getDate() + 1);
|
|
29
29
|
}
|
|
30
30
|
});
|
|
@@ -33,32 +33,32 @@ const getNextNthWorkingDay = (date, filterDaysIndex, numberOfWorkingDays) => {
|
|
|
33
33
|
exports.getNextNthWorkingDay = getNextNthWorkingDay;
|
|
34
34
|
const getPreviousNthWorkingDay = (date, filterDaysIndex, numberOfWorkingDays) => {
|
|
35
35
|
const currentDate = new Date(date.toDateString());
|
|
36
|
-
const holidaysFormatted = exports.holidays.map((holiday) => (0, zeniDayJS_1.date)(holiday.toDateString()).format(standardFormat));
|
|
36
|
+
const holidaysFormatted = exports.holidays.map((holiday) => (0, zeniDayJS_1.date)(holiday.toDateString()).format(exports.standardFormat));
|
|
37
37
|
Array(numberOfWorkingDays)
|
|
38
38
|
.fill(0)
|
|
39
39
|
.forEach(() => {
|
|
40
40
|
while (filterDaysIndex.includes(currentDate.getDay()) ||
|
|
41
|
-
holidaysFormatted.indexOf((0, zeniDayJS_1.date)(currentDate.toDateString()).format(standardFormat)) != -1) {
|
|
41
|
+
holidaysFormatted.indexOf((0, zeniDayJS_1.date)(currentDate.toDateString()).format(exports.standardFormat)) != -1) {
|
|
42
42
|
currentDate.setDate(currentDate.getDate() - 1);
|
|
43
43
|
}
|
|
44
44
|
currentDate.setDate(currentDate.getDate() - 1);
|
|
45
45
|
});
|
|
46
46
|
while (filterDaysIndex.includes(currentDate.getDay()) ||
|
|
47
|
-
holidaysFormatted.indexOf((0, zeniDayJS_1.date)(currentDate.toDateString()).format(standardFormat)) != -1) {
|
|
47
|
+
holidaysFormatted.indexOf((0, zeniDayJS_1.date)(currentDate.toDateString()).format(exports.standardFormat)) != -1) {
|
|
48
48
|
currentDate.setDate(currentDate.getDate() - 1);
|
|
49
49
|
}
|
|
50
50
|
return currentDate;
|
|
51
51
|
};
|
|
52
52
|
exports.getPreviousNthWorkingDay = getPreviousNthWorkingDay;
|
|
53
53
|
const isHolidayToday = (filterDaysIndex) => {
|
|
54
|
-
const holidaysFormatted = exports.holidays.map((holiday) => (0, zeniDayJS_1.date)(holiday.toDateString()).format(standardFormat));
|
|
54
|
+
const holidaysFormatted = exports.holidays.map((holiday) => (0, zeniDayJS_1.date)(holiday.toDateString()).format(exports.standardFormat));
|
|
55
55
|
const currentDate = new Date();
|
|
56
56
|
return (filterDaysIndex.includes(currentDate.getDay()) ||
|
|
57
|
-
holidaysFormatted.indexOf((0, zeniDayJS_1.date)(currentDate.toDateString()).format(standardFormat)) != -1);
|
|
57
|
+
holidaysFormatted.indexOf((0, zeniDayJS_1.date)(currentDate.toDateString()).format(exports.standardFormat)) != -1);
|
|
58
58
|
};
|
|
59
59
|
exports.isHolidayToday = isHolidayToday;
|
|
60
60
|
const filterDays = (date, filterDaysIndex) => {
|
|
61
|
-
const formattedDate = (0, zeniDayJS_1.date)(date.toDateString()).format(standardFormat);
|
|
61
|
+
const formattedDate = (0, zeniDayJS_1.date)(date.toDateString()).format(exports.standardFormat);
|
|
62
62
|
return (filterDaysIndex.includes(date.getDay()) === false &&
|
|
63
63
|
exports.holidaysFormatted.includes(formattedDate) === false);
|
|
64
64
|
};
|
|
@@ -81,6 +81,7 @@ const getHolidaysListPerYear = (year) => {
|
|
|
81
81
|
const holidaysPerYear = {
|
|
82
82
|
[(0, zeniDayJS_1.dateNow)().year()]: getHolidaysListPerYear((0, zeniDayJS_1.dateNow)().year()),
|
|
83
83
|
};
|
|
84
|
+
//isHoliday requires date parameter to be simple date Dayjs format, not datetime Dayjs
|
|
84
85
|
const isHoliday = (date) => {
|
|
85
86
|
const currentYear = date.year();
|
|
86
87
|
let holidays = [];
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mapReviewTransferMoneyPayloadToReviewTransferMoney = void 0;
|
|
4
4
|
const amount_1 = require("../../../../commonStateTypes/amount");
|
|
5
|
+
const workingDayHelper_1 = require("../../../../commonStateTypes/workingDayHelper");
|
|
5
6
|
const zeniDayJS_1 = require("../../../../zeniDayJS");
|
|
6
7
|
const mapReviewTransferMoneyPayloadToReviewTransferMoney = (payload) => ({
|
|
7
8
|
isShowDailyAchLimitWarning: payload.is_show_daily_ach_limit_warning,
|
|
8
9
|
dailyAchDebitLimit: payload.daily_ach_debit_limit != null
|
|
9
10
|
? (0, amount_1.toAmount)(payload.daily_ach_debit_limit.amount, payload.daily_ach_debit_limit.currency_code, payload.daily_ach_debit_limit.currency_symbol)
|
|
10
11
|
: (0, amount_1.toAmount)(0, 'USD', '$'),
|
|
11
|
-
transferSchedules: payload.transfer_schedules.map((transfer_schedule) => (Object.assign(Object.assign({}, (0, amount_1.toAmount)(transfer_schedule.amount, transfer_schedule.currency_code, transfer_schedule.currency_symbol)), { scheduleTime: (0, zeniDayJS_1.
|
|
12
|
+
transferSchedules: payload.transfer_schedules.map((transfer_schedule) => (Object.assign(Object.assign({}, (0, amount_1.toAmount)(transfer_schedule.amount, transfer_schedule.currency_code, transfer_schedule.currency_symbol)), { scheduleTime: (0, zeniDayJS_1.date)(
|
|
13
|
+
//this is required as isHoliday function in src/commonStateTypes/workingDayHelper.ts require date to be simple date Dayjs format, not datetime Dayjs
|
|
14
|
+
(0, zeniDayJS_1.date)(transfer_schedule.schedule_time).format(workingDayHelper_1.standardFormat)) }))),
|
|
12
15
|
});
|
|
13
16
|
exports.mapReviewTransferMoneyPayloadToReviewTransferMoney = mapReviewTransferMoneyPayloadToReviewTransferMoney;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.9.
|
|
3
|
+
"version": "4.9.82",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|