Skip to content

Commit

Permalink
Merge branch 'master' into IOBP-514-effettuare-chiamata-di-new-transa…
Browse files Browse the repository at this point in the history
…ction-subito-dopo-che-il-metodo-viene-selezionato
  • Loading branch information
mastro993 authored Jan 23, 2024
2 parents 07b2479 + 46af866 commit 9f57968
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ts/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const remindersOptInEnabled = Config.REMINDERS_OPT_IN_ENABLED === "YES";
export const isNewCduFlow = Config.CDU_NEW_FLOW === "YES";

// version of ToS
export const tosVersion: NonNegativeNumber = 4.7 as NonNegativeNumber;
export const tosVersion: NonNegativeNumber = 4.8 as NonNegativeNumber;

export const fetchTimeout = pipe(
parseInt(Config.FETCH_TIMEOUT_MS, 10),
Expand Down
3 changes: 2 additions & 1 deletion ts/features/walletV3/details/screens/WalletDetailsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
} from "../store";
import { walletDetailsGetInstrument } from "../store/actions";
import { UIWalletInfoDetails } from "../types/UIWalletInfoDetails";
import { getDateFromExpiryDate } from "../../../../utils/dates";

export type WalletDetailsScreenNavigationParams = Readonly<{
walletId: string;
Expand All @@ -46,7 +47,7 @@ const generateCardComponent = (details: UIWalletInfoDetails) => {
<PaymentCardBig
testID="CreditCardComponent"
cardType="CREDIT"
expirationDate={details.expiryDate}
expirationDate={getDateFromExpiryDate(details.expiryDate)}
holderName={details.holder || ""}
hpan={details.maskedPan || ""}
cardIcon={details.brand?.toLowerCase() as IOLogoPaymentExtType}
Expand Down
14 changes: 12 additions & 2 deletions ts/utils/dates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ export const isExpired = (
* @param expiryDate
*/
export const isExpiredDate = (expiryDate: string): boolean => {
const year = +expiryDate.slice(3, 5);
const month = +expiryDate.slice(0, 3);
const year = +expiryDate.slice(0, 4);
const month = +expiryDate.slice(4, 6);
const now = new Date();
const nowYearMonth = new Date(now.getFullYear(), now.getMonth() + 1);
const cardExpirationDate = new Date(year, month);
Expand Down Expand Up @@ -320,3 +320,13 @@ export const toAndroidCacheTimestamp = () =>
new Date(),
I18n.t("global.dateFormats.shortFormat").replace(/\//g, "")
);

/**
* This function returns a Date object from a string in format "YYYYMM"
* @param expiryDate
*/
export const getDateFromExpiryDate = (expiryDate: string): Date => {
const year = +expiryDate.slice(0, 4);
const month = +expiryDate.slice(4, 6);
return new Date(year, month - 1);
};

0 comments on commit 9f57968

Please sign in to comment.