diff --git a/src/pages/settings/Wallet/ImportTransactionsCardNamePage.tsx b/src/pages/settings/Wallet/ImportTransactionsCardNamePage.tsx index 0bcaaf00a6989..967ac19a73263 100644 --- a/src/pages/settings/Wallet/ImportTransactionsCardNamePage.tsx +++ b/src/pages/settings/Wallet/ImportTransactionsCardNamePage.tsx @@ -13,6 +13,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import {setImportTransactionCardName} from '@libs/actions/ImportSpreadsheet'; import {addErrorMessage} from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; +import {isValidInputLength} from '@libs/ValidationUtils'; import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import INPUT_IDS from '@src/types/form/ImportTransactionsForm'; @@ -34,8 +35,10 @@ function ImportTransactionsCardNamePage() { const errors: FormInputErrors = {}; const name = values.cardDisplayName.trim(); - if ([...name].length > CONST.TITLE_CHARACTER_LIMIT) { - addErrorMessage(errors, 'cardDisplayName', translate('common.error.characterLimitExceedCounter', [...name].length, CONST.TITLE_CHARACTER_LIMIT)); + const {isValid, byteLength} = isValidInputLength(name, CONST.TITLE_CHARACTER_LIMIT); + + if (!isValid) { + addErrorMessage(errors, 'cardDisplayName', translate('common.error.characterLimitExceedCounter', byteLength, CONST.TITLE_CHARACTER_LIMIT)); } return errors;