@zeniai/client-epic-state 4.7.97 → 4.7.98
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ZeniDate } from '../zeniDayJS';
|
|
1
2
|
export declare const startDate = "2000-01-01";
|
|
2
3
|
export declare const endDate = "2070-12-31";
|
|
3
4
|
export declare const PAYMENT_BUSINESS_DAYS = 4;
|
|
@@ -8,4 +9,4 @@ export declare const getPreviousNthWorkingDay: (date: Date, filterDaysIndex: num
|
|
|
8
9
|
export declare const isHolidayToday: (filterDaysIndex: number[]) => boolean;
|
|
9
10
|
export declare const filterDays: (date: Date, filterDaysIndex: number[]) => boolean;
|
|
10
11
|
export declare const getYearsList: (startYear?: number, endYear?: number) => number[];
|
|
11
|
-
export declare const isHoliday: (date:
|
|
12
|
+
export declare const isHoliday: (date: ZeniDate) => boolean;
|
|
@@ -72,17 +72,25 @@ const getYearsList = (startYear = 2000, endYear = new Date().getFullYear()) => {
|
|
|
72
72
|
return years;
|
|
73
73
|
};
|
|
74
74
|
exports.getYearsList = getYearsList;
|
|
75
|
+
const getHolidaysListPerYear = (year) => {
|
|
76
|
+
return dateHolidays
|
|
77
|
+
.getHolidays(year)
|
|
78
|
+
.filter((holiday) => holiday.type === 'public' || holiday.type === 'bank')
|
|
79
|
+
.map((holiday) => (0, zeniDayJS_1.date)(holiday.date).toString());
|
|
80
|
+
};
|
|
81
|
+
const holidaysPerYear = {
|
|
82
|
+
[(0, zeniDayJS_1.dateNow)().year()]: getHolidaysListPerYear((0, zeniDayJS_1.dateNow)().year()),
|
|
83
|
+
};
|
|
75
84
|
const isHoliday = (date) => {
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
else if (holidayDetails[0].type === 'bank' ||
|
|
81
|
-
holidayDetails[0].type === 'public') {
|
|
82
|
-
return true;
|
|
85
|
+
const currentYear = date.year();
|
|
86
|
+
let holidays = [];
|
|
87
|
+
if (holidaysPerYear[currentYear] != null) {
|
|
88
|
+
holidays = holidaysPerYear[currentYear];
|
|
83
89
|
}
|
|
84
90
|
else {
|
|
85
|
-
|
|
91
|
+
holidays = getHolidaysListPerYear(currentYear);
|
|
92
|
+
holidaysPerYear[currentYear] = holidays;
|
|
86
93
|
}
|
|
94
|
+
return holidays.indexOf(date.toString()) >= 0;
|
|
87
95
|
};
|
|
88
96
|
exports.isHoliday = isHoliday;
|
package/lib/index.d.ts
CHANGED
|
@@ -610,7 +610,7 @@ import { fetchArAgingDetail, updateArAgingDetailUIState } from './view/arAgingVi
|
|
|
610
610
|
import { ArAgingDetail, getArAgingDetailForCustomer } from './view/arAgingView/arAgingDetail/arAgingDetailSelector';
|
|
611
611
|
export { fetchArAging, updateArAgingUIState, fetchArAgingDetail, updateArAgingDetailUIState, ArAgingReport, ArAgingDetail, AgingBalancesByCustomer, getArAgingReport, getArAgingDetailForCustomer, };
|
|
612
612
|
import { toRecurringBillFrequency, toRecurringBillFrequencyStrict, RecurringBillFrequency, RecurringBillDetail, RecurringBillConfig, RecurringBillStatus, RecurringBillPaymentStatus } from './entity/billPay/recurringBills/recurringBillsState';
|
|
613
|
-
export { toRecurringBillFrequency, toRecurringBillFrequencyStrict, RecurringBillFrequency, RecurringBillDetail, RecurringBillConfig, RecurringBillStatus, RecurringBillPaymentStatus };
|
|
613
|
+
export { toRecurringBillFrequency, toRecurringBillFrequencyStrict, RecurringBillFrequency, RecurringBillDetail, RecurringBillConfig, RecurringBillStatus, RecurringBillPaymentStatus, };
|
|
614
614
|
import { Task, TaskStatusCodeType, PriorityCodeType, TaskTagCodeType, TaskTag, TaskStatus, TaskPriority } from './entity/task/task';
|
|
615
615
|
import { TaskListSelectorView, TaskWithUserDetails, getAllTasks } from './view/taskManager/taskListView/taskListSelector';
|
|
616
616
|
import { TaskListViewSortKey, TaskListUIState, TaskListFilters, TASK_LIST_FILTER_CATEGORIES, TaskListFilterCategoryField, TaskFilterCategory } from './view/taskManager/taskListView/taskList';
|
|
@@ -47,7 +47,7 @@ const getSelectedCompanyOfficer = (verificationDetails) => {
|
|
|
47
47
|
exports.getSelectedCompanyOfficer = getSelectedCompanyOfficer;
|
|
48
48
|
const getPaymentDateFromVendorReceiveDate = (vendorReceiveDate, maxPaymentProcessingDays) => {
|
|
49
49
|
let paymentDate = vendorReceiveDate.subtract(maxPaymentProcessingDays, 'day');
|
|
50
|
-
while ((0, workingDayHelper_1.isHoliday)(paymentDate
|
|
50
|
+
while ((0, workingDayHelper_1.isHoliday)(paymentDate) === true) {
|
|
51
51
|
paymentDate = paymentDate.subtract(1, 'day');
|
|
52
52
|
}
|
|
53
53
|
return paymentDate;
|
|
@@ -71,20 +71,18 @@ const updateRecurringBillDetails = (currentRecurringConfig, prevRecurringConfig,
|
|
|
71
71
|
let currentEndDate = endDate;
|
|
72
72
|
let currentTotalPayments = totalPaymentCycles;
|
|
73
73
|
const currentInstance = currentInstances === null || currentInstances === void 0 ? void 0 : currentInstances.find((instance) => Boolean(instance.readonly) === false);
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
if (endDate != null &&
|
|
75
|
+
((prevRecurringConfig != null &&
|
|
76
|
+
endDateSelectorOptionType == null &&
|
|
77
|
+
(0, exports.isRecurringConfigChanged)(currentRecurringConfig, prevRecurringConfig, false) &&
|
|
78
|
+
totalPaymentCycles !== 0) ||
|
|
79
|
+
totalPaymentCycles === 0 ||
|
|
80
|
+
endDateSelectorOptionType === 'date')) {
|
|
80
81
|
currentTotalPayments = (0, exports.getTotalPayments)(startDate, endDate, frequency, currentInstance);
|
|
81
82
|
}
|
|
82
83
|
else if (endDate == null || endDateSelectorOptionType === 'payments') {
|
|
83
84
|
currentEndDate = (0, exports.getEndDate)(startDate, frequency, totalPaymentCycles, currentInstance);
|
|
84
85
|
}
|
|
85
|
-
else if (totalPaymentCycles === 0 || endDateSelectorOptionType === 'date') {
|
|
86
|
-
currentTotalPayments = (0, exports.getTotalPayments)(startDate, endDate, frequency, currentInstance);
|
|
87
|
-
}
|
|
88
86
|
//editRecurringBill
|
|
89
87
|
if (currentRecurringConfig.isActive &&
|
|
90
88
|
currentInstances != null &&
|
|
@@ -167,7 +165,7 @@ function getRecurringFrequencyInDays(frequency) {
|
|
|
167
165
|
function checkIfHolidayAndGetNextDate(date) {
|
|
168
166
|
const isHolidayMessage = 'is a holiday';
|
|
169
167
|
let newDate = date;
|
|
170
|
-
while ((0, workingDayHelper_1.isHoliday)(newDate
|
|
168
|
+
while ((0, workingDayHelper_1.isHoliday)(newDate) === true) {
|
|
171
169
|
newDate = newDate.subtract(1, 'day');
|
|
172
170
|
}
|
|
173
171
|
if (newDate !== date) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.98",
|
|
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",
|