@riocrypto/common 1.0.2151 → 1.0.2152
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,8 +1,10 @@
|
|
|
1
1
|
import { Country } from "../types/country";
|
|
2
|
-
|
|
2
|
+
import { TwoWaySettlementType } from "../types/two-way-settlement-type";
|
|
3
|
+
export declare const getDaysUntilTwoWaySettlementDate: ({ country, holidays, twoWaySettlementType, twoWaySettlementDateOffset, }: {
|
|
3
4
|
country: Country;
|
|
4
5
|
holidays: {
|
|
5
6
|
dates: string[];
|
|
6
7
|
};
|
|
7
8
|
twoWaySettlementDateOffset: number;
|
|
9
|
+
twoWaySettlementType: TwoWaySettlementType;
|
|
8
10
|
}) => number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getDaysUntilTwoWaySettlementDate = void 0;
|
|
4
|
+
const two_way_settlement_type_1 = require("../types/two-way-settlement-type");
|
|
4
5
|
const get_country_timezone_1 = require("./get-country-timezone");
|
|
5
6
|
const should_add_one_day_to_settlement_date_1 = require("./should-add-one-day-to-settlement-date");
|
|
6
7
|
const formatDateInTimezone = (date, timezone) => {
|
|
@@ -11,7 +12,10 @@ const formatDateInTimezone = (date, timezone) => {
|
|
|
11
12
|
const day = String(dateInTimezone.getDate()).padStart(2, "0");
|
|
12
13
|
return `${year}-${month}-${day}`;
|
|
13
14
|
};
|
|
14
|
-
const getDaysUntilTwoWaySettlementDate = ({ country, holidays, twoWaySettlementDateOffset, }) => {
|
|
15
|
+
const getDaysUntilTwoWaySettlementDate = ({ country, holidays, twoWaySettlementType, twoWaySettlementDateOffset, }) => {
|
|
16
|
+
if (twoWaySettlementType === two_way_settlement_type_1.TwoWaySettlementType.Default) {
|
|
17
|
+
return 0;
|
|
18
|
+
}
|
|
15
19
|
let businessDaysToAdd = twoWaySettlementDateOffset;
|
|
16
20
|
// If in Asia time, add 1 day to the offset
|
|
17
21
|
const isAsiaTime = (0, should_add_one_day_to_settlement_date_1.shouldAddOneDayToSettlementDate)();
|