@riocrypto/common 1.0.2524 → 1.0.2526
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/helpers/get-days-between-agreed-two-way-settlement-date-and-payment-date.js +5 -7
- package/build/helpers/get-days-until-two-way-settlement-date.js +6 -8
- package/build/types/binance-rfq-quote.d.ts +1 -0
- package/build/types/binance-rfq-trade.d.ts +1 -0
- package/build/types/order.d.ts +1 -0
- package/package.json +1 -1
|
@@ -3,12 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getDaysBetweenAgreedTwoWaySettlementDateAndPaymentDate = void 0;
|
|
4
4
|
const deferred_payment_type_1 = require("../types/deferred-payment-type");
|
|
5
5
|
const get_country_timezone_1 = require("./get-country-timezone");
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const month = String(dateInTimezone.getMonth() + 1).padStart(2, "0");
|
|
11
|
-
const day = String(dateInTimezone.getDate()).padStart(2, "0");
|
|
6
|
+
const formatLocalDate = (date) => {
|
|
7
|
+
const year = date.getFullYear();
|
|
8
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
9
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
12
10
|
return `${year}-${month}-${day}`;
|
|
13
11
|
};
|
|
14
12
|
const getDaysBetweenAgreedTwoWaySettlementDateAndPaymentDate = ({ country, holidays, twoWaySettlementDate, deferredPaymentType, }) => {
|
|
@@ -23,7 +21,7 @@ const getDaysBetweenAgreedTwoWaySettlementDateAndPaymentDate = ({ country, holid
|
|
|
23
21
|
nextBusinessDay.setDate(settlementDateInCountryTZ.getDate() + 1);
|
|
24
22
|
while (true) {
|
|
25
23
|
const isWeekend = nextBusinessDay.getDay() === 0 || nextBusinessDay.getDay() === 6;
|
|
26
|
-
const isHoliday = holidays.dates.includes(
|
|
24
|
+
const isHoliday = holidays.dates.includes(formatLocalDate(nextBusinessDay));
|
|
27
25
|
if (!isWeekend && !isHoliday) {
|
|
28
26
|
break; // Found the next business day
|
|
29
27
|
}
|
|
@@ -4,12 +4,10 @@ exports.getDaysUntilTwoWaySettlementDate = void 0;
|
|
|
4
4
|
const two_way_settlement_type_1 = require("../types/two-way-settlement-type");
|
|
5
5
|
const get_country_timezone_1 = require("./get-country-timezone");
|
|
6
6
|
const should_add_one_day_to_settlement_date_1 = require("./should-add-one-day-to-settlement-date");
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const month = String(dateInTimezone.getMonth() + 1).padStart(2, "0");
|
|
12
|
-
const day = String(dateInTimezone.getDate()).padStart(2, "0");
|
|
7
|
+
const formatLocalDate = (date) => {
|
|
8
|
+
const year = date.getFullYear();
|
|
9
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
10
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
13
11
|
return `${year}-${month}-${day}`;
|
|
14
12
|
};
|
|
15
13
|
const getDaysUntilTwoWaySettlementDate = ({ country, holidays, twoWaySettlementType, twoWaySettlementDateOffset, }) => {
|
|
@@ -32,7 +30,7 @@ const getDaysUntilTwoWaySettlementDate = ({ country, holidays, twoWaySettlementT
|
|
|
32
30
|
// Find today if it's a business day, otherwise the next business day
|
|
33
31
|
while (true) {
|
|
34
32
|
const isWeekend = settlementDate.getDay() === 0 || settlementDate.getDay() === 6;
|
|
35
|
-
const isHoliday = holidays.dates.includes(
|
|
33
|
+
const isHoliday = holidays.dates.includes(formatLocalDate(settlementDate));
|
|
36
34
|
if (!isWeekend && !isHoliday) {
|
|
37
35
|
break; // Found the business day
|
|
38
36
|
}
|
|
@@ -45,7 +43,7 @@ const getDaysUntilTwoWaySettlementDate = ({ country, holidays, twoWaySettlementT
|
|
|
45
43
|
while (businessDaysAdded < businessDaysToAdd) {
|
|
46
44
|
settlementDate.setDate(settlementDate.getDate() + 1);
|
|
47
45
|
const isWeekend = settlementDate.getDay() === 0 || settlementDate.getDay() === 6;
|
|
48
|
-
const isHoliday = holidays.dates.includes(
|
|
46
|
+
const isHoliday = holidays.dates.includes(formatLocalDate(settlementDate));
|
|
49
47
|
if (!isWeekend && !isHoliday) {
|
|
50
48
|
businessDaysAdded++;
|
|
51
49
|
}
|
package/build/types/order.d.ts
CHANGED