@riocrypto/common 1.0.2523 → 1.0.2525

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.
@@ -5,6 +5,7 @@ export interface AsyncCryptoPaymentCompletedEvent {
5
5
  orderId: string;
6
6
  amount: number;
7
7
  depositTxId: string;
8
+ fireblocksTransferId?: string;
8
9
  originBlockchainAddress?: string;
9
10
  };
10
11
  }
@@ -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 formatDateInTimezone = (date, timezone) => {
7
- // Format the date in the specified timezone as YYYY-MM-DD
8
- const dateInTimezone = new Date(date.toLocaleString("en-US", { timeZone: timezone }));
9
- const year = dateInTimezone.getFullYear();
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(formatDateInTimezone(nextBusinessDay, timezone));
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 formatDateInTimezone = (date, timezone) => {
8
- // Format the date in the specified timezone as YYYY-MM-DD
9
- const dateInTimezone = new Date(date.toLocaleString("en-US", { timeZone: timezone }));
10
- const year = dateInTimezone.getFullYear();
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(formatDateInTimezone(settlementDate, timezone));
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(formatDateInTimezone(settlementDate, timezone));
46
+ const isHoliday = holidays.dates.includes(formatLocalDate(settlementDate));
49
47
  if (!isWeekend && !isHoliday) {
50
48
  businessDaysAdded++;
51
49
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.2523",
3
+ "version": "1.0.2525",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",